is da auch ein fehler ?
<?php
$dat = file('datei.txt');
for ($i=count($dat);$i>=0;$i--) {
$ein = explode('#',$dat[$i]);
echo "[b].$ein[0].[/b].$ein[1].<hr> ";
}
?>
Hier kann eine Notiz zum Merk-Eintrag hinzugefügt werden (optional)
| Geschlossen | ||
<?php
$dat = file('datei.txt');
for ($i=count($dat);$i>=0;$i--) {
$ein = explode('#',$dat[$i]);
echo "[b].$ein[0].[/b].$ein[1].<hr> ";
}
?>

<?php
$dat = file('datei.txt');
for ($i=count($dat);$i>=0;$i--) {
$ein = explode('#',$dat[$i]);
echo '<b>'.$ein[0].'</b><br>'.$ein[1].'<hr> ';
}
?>
hab es ein wenig umgebaut ...
<?php
function content($file) {
if(!file_exists($file)) {
return FALSE;
} else {
$content = implode("", file($file));
return $content;
}
}
echo content("datei.txt");
?>
Write :<BR><bR> <form action="save.php" method="POST"> Name <input type="text" name="creator"> <BR> <BR> Message<br> <textarea cols="20" rows="6" name="textarea"></textarea> <BR> <input type="submit" value="Eintragen"> </form>
<?php
$text = str_replace("\n","",$textarea) ;
$test = str_replace("#","",$textarea);
$neueZeile = "<table width=90% border=0 align=center cellpadding=0 cellspacing=1><tr bgcolor=000000><td width=100% class=rahmen bgcolor=777777>$textarea</td></tr><tr><td width=100%><div align=left><small>Posted by - $creator</small></div></td></tr></table><BR><BR>";
$oeffnen = fopen ('datei.txt', "a +");
fwrite ($oeffnen, $neueZeile) or die ("NEIN");
fclose ($oeffnen);
?>
<?php
if($PHP_AUTH_USER!="Name" OR
$PHP_AUTH_PW!="passwort") {
Header('HTTP/1.1 401 Unauthorized');
Header('WWW-Authenticate: Basic realm="News edit"');
echo "Mit Abbrechen kommst Du hier nicht rein. ;-) \n";
exit;
}
?>
Edit :<BR><bR>
<?php
$file = "datei.txt";
echo "<form action=\"$PHP_SELF\" method=\"POST\">";
echo "<textarea name=\"text\" cols=\"60\" rows=\"30\">";
readfile($file);
echo "</textarea><BR>";
echo "<input type=\"submit\" name=\"gesendet\" value=\"speichern\">";
echo "</form><BR>";
if ($gesendet) {
$datei_speichern=fopen($file, "w");
fwrite ($datei_speichern, $_POST['text']);
fclose($datei_speichern);
echo "Änderung erfolgreich";
}
?>
| Geschlossen | ||
![]() |
Zurück zu HTML, PHP, SQL,... | |