gebruiker35
Gebruiker
- Lid geworden
- 29 mrt 2008
- Berichten
- 434
Ik zit met een probleem. Heb een nieuwssysteem gebouwd. Voor ieder nieuwsbericht is er een aparte .txt, max. 50 nieuwsberichten. De eerste 4 nieuwsberichten toevoegen gaat goed, bij de 5e krijg ik een wit scherm, zodra ik het dan opnieuw doe, wordt het laaste bericht 6 keer weergegeven.
code:
code:
PHP:
<?php session_start();
$leeg = "";
if ($_GET["clean"] == "all") {
if (($_SESSI") {
$a=fopen("1.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("2.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("3.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("4.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("5.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("6.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("7.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("8.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("9.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("10.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("11.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("12.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("13.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("14.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("15.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("16.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("17.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("18.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("19.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("20.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("21.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("22.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("23.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("24.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("25.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("26.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("27.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("28.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("29.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("30.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("31.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("32.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("33.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("34.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("35.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("36.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("37.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("38.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("39.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("40.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("41.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("42.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("43.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("44.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("45.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("46.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("47.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("48.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("49.txt","w");
fwrite($a,$leeg);
fclose($a);
$a=fopen("50.txt","w");
fwrite($a,$leeg);
fclose($a);
}
}
if ($_SESSION['U'] != ) {
if ($_SESSION['U'] != ) {
if ($_SESSION['U'] != ) { die(); }} }
if(isset($_POST["OK"]) OR isset($_POST["field1"]) OR isset($_POST["field2"]))
{
setlocale (LC_ALL, 'nl_NL');
$tijd = strftime ("%T");
$datum = strftime ("%d-%m-%y");
$bericht = $_POST["reactie"];
$titel = $_POST["titel"];
$len = strlen($bericht);
for($i = 0; $i < $len; $i++)
{
if(ord($bericht[$i]) == 97){
die();
}
}
$bericht = htmlspecialchars($bericht);
$bericht = nl2br($bericht);
$bericht = eregi_replace("(^|[ \n\r\t])((http(s?)://)(www.)?([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = eregi_replace("(^|[ \n\r\t])((ftp://)(www.)?([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = eregi_replace("([a-z_-][a-z0-9\._-]*@[a-z0-9_-]+(\.[a-z0-9_-]+)+)","<a href=\"mailto:\\1\">\\1</a>", $bericht);
$bericht = eregi_replace("(^|[ \n\r\t])(www.([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = eregi_replace("(^|[ \n\r\t])(ftp.([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"ftp://\\2\" target=\"_blank\">\\2</a>", $bericht);
$time = " <div id='time'> $tijd | $datum </div> ";
$newmes = " <div id='naam'> $time $titel</div> <div id='bericht'> $bericht </div><p>
";
$n1 = file_get_contents("1.txt");
$n2 = file_get_contents("2.txt");
$n3 = file_get_contents("3.txt");
$n4 = file_get_contents("4.txt");
$n5 = file_get_contents("4.txt");
$n6 = file_get_contents("4.txt");
$n7 = file_get_contents("4.txt");
$n8 = file_get_contents("4.txt");
$n9 = file_get_contents("4.txt");
$n10 = file_get_contents("10.txt");
$n11 = file_get_contents("11.txt");
$n12 = file_get_contents("12.txt");
$n13 = file_get_contents("13.txt");
$n14 = file_get_contents("14.txt");
$n15 = file_get_contents("15.txt");
$n16 = file_get_contents("16.txt");
$n17 = file_get_contents("17.txt");
$n18 = file_get_contents("18.txt");
$n19 = file_get_contents("19.txt");
$n20 = file_get_contents("20.txt");
$n21 = file_get_contents("21.txt");
$n22 = file_get_contents("22.txt");
$n23 = file_get_contents("23.txt");
$n24 = file_get_contents("24.txt");
$n25 = file_get_contents("25.txt");
$n26 = file_get_contents("26.txt");
$n27 = file_get_contents("27.txt");
$n28 = file_get_contents("28.txt");
$n29 = file_get_contents("29.txt");
$n30 = file_get_contents("30.txt");
$n31 = file_get_contents("31.txt");
$n32 = file_get_contents("32.txt");
$n33 = file_get_contents("33.txt");
$n34 = file_get_contents("34.txt");
$n35 = file_get_contents("35.txt");
$n36 = file_get_contents("36.txt");
$n37 = file_get_contents("37.txt");
$n38 = file_get_contents("38.txt");
$n39 = file_get_contents("39.txt");
$n40 = file_get_contents("40.txt");
$n41 = file_get_contents("41.txt");
$n42 = file_get_contents("42.txt");
$n43 = file_get_contents("43.txt");
$n44 = file_get_contents("44.txt");
$n45 = file_get_contents("45.txt");
$n46 = file_get_contents("46.txt");
$n47 = file_get_contents("47.txt");
$n48 = file_get_contents("48.txt");
$n49 = file_get_contents("49.txt");
$n50 = file_get_contents("50.txt");
$a=fopen("1.txt","w");
fwrite($a,$newmes);
fclose($a);
$a=fopen("2.txt","w");
fwrite($a,$n1);
fclose($a);
$a=fopen("3.txt","w");
fwrite($a,$n2);
fclose($a);
$a=fopen("4.txt","w");
fwrite($a,$n3);
fclose($a);
$a=fopen("5.txt","w");
fwrite($a,$n4);
fclose($a);
$a=fopen("6.txt","w");
fwrite($a,$n5);
fclose($a);
$a=fopen("7.txt","w");
fwrite($a,$n6);
fclose($a);
$a=fopen("8.txt","w");
fwrite($a,$n7);
fclose($a);
$a=fopen("9.txt","w");
fwrite($a,$n8);
fclose($a);
$a=fopen("10.txt","w");
fwrite($a,$n9);
fclose($a);
$a=fopen("11.txt","w");
fwrite($a,$n10);
fclose($a);
$a=fopen("12.txt","w");
fwrite($a,$n11);
fclose($a);
$a=fopen("13.txt","w");
fwrite($a,$n12);
fclose($a);
$a=fopen("14.txt","w");
fwrite($a,$n13);
fclose($a);
$a=fopen("15.txt","w");
fwrite($a,$n14);
fclose($a);
$a=fopen("16.txt","w");
fwrite($a,$n15);
fclose($a);
$a=fopen("17.txt","w");
fwrite($a,$n16);
fclose($a);
$a=fopen("18.txt","w");
fwrite($a,$n17);
fclose($a);
$a=fopen("19.txt","w");
fwrite($a,$n18);
fclose($a);
$a=fopen("20.txt","w");
fwrite($a,$n19);
fclose($a);
$a=fopen("21.txt","w");
fwrite($a,$n20);
fclose($a);
$a=fopen("22.txt","w");
fwrite($a,$n21);
fclose($a);
$a=fopen("23.txt","w");
fwrite($a,$n22);
fclose($a);
$a=fopen("24.txt","w");
fwrite($a,$n23);
fclose($a);
$a=fopen("25.txt","w");
fwrite($a,$n24);
fclose($a);
$a=fopen("26.txt","w");
fwrite($a,$n25);
fclose($a);
$a=fopen("27.txt","w");
fwrite($a,$n26);
fclose($a);
$a=fopen("28.txt","w");
fwrite($a,$n27);
fclose($a);
$a=fopen("29.txt","w");
fwrite($a,$n28);
fclose($a);
$a=fopen("30.txt","w");
fwrite($a,$n29);
fclose($a);
$a=fopen("31.txt","w");
fwrite($a,$n30);
fclose($a);
$a=fopen("32.txt","w");
fwrite($a,$n31);
fclose($a);
$a=fopen("33.txt","w");
fwrite($a,$n32);
fclose($a);
$a=fopen("34.txt","w");
fwrite($a,$n33);
fclose($a);
$a=fopen("35.txt","w");
fwrite($a,$n34);
fclose($a);
$a=fopen("36.txt","w");
fwrite($a,$n35);
fclose($a);
$a=fopen("37.txt","w");
fwrite($a,$n36);
fclose($a);
$a=fopen("38.txt","w");
fwrite($a,$n37);
fclose($a);
$a=fopen("39.txt","w");
fwrite($a,$n38);
fclose($a);
$a=fopen("40.txt","w");
fwrite($a,$n39);
fclose($a);
$a=fopen("41.txt","w");
fwrite($a,$n40);
fclose($a);
$a=fopen("42.txt","w");
fwrite($a,$n41);
fclose($a);
$a=fopen("43.txt","w");
fwrite($a,$n42);
fclose($a);
$a=fopen("44.txt","w");
fwrite($a,$n43);
fclose($a);
$a=fopen("45.txt","w");
fwrite($a,$n44);
fclose($a);
$a=fopen("46.txt","w");
fwrite($a,$n45);
fclose($a);
$a=fopen("47.txt","w");
fwrite($a,$n46);
fclose($a);
$a=fopen("48.txt","w");
fwrite($a,$n47);
fclose($a);
$a=fopen("49.txt","w");
fwrite($a,$n48);
fclose($a);
$a=fopen("50.txt","w");
fwrite($a,$n49);
fclose($a);
}
?>
<html>
<head>
<LINK href='stylemenu.css' REL='stylesheet' TYPE='text/css'>
<meta http-equiv="Content-Language" content="nl">
</head>
<body>
<p>
<form name='nieuws' method='POST' action='./nieuwstoevoegen.php'>
Titel nieuwsbericht: <input type="text" name="titel" size="20">
<p>Type je bericht:<br>
<textarea onblur="this.className='blur'" onfocus="this.className='focus'" type='text' name='reactie' cols=50 rows=6 maxlength='9999999' value='' ></textarea>
<br>
<input type='submit' value='Plaats bericht' name='OK' class='button'>
</p>
</body>
</html>
<html>
<head>
</head>
<body>
<frame width="200" height="100"><?php include ("./nieuws.php"); ?></iframe>
<p>
</body>
</html>
Laatst bewerkt: