Hi wahsaga,
also ich versteh das schon, doch bei mir dreht der nicht die Einträge
sondern immer nur die vom Benutzer eingegeben Daten.
Hier noch mal der Code:
-----index.php
<?php
include 'inc\config.inc';
if ($action == "senden")
{
$datei = fopen ($file, "a+");
$eintrag = $name."|".$email."|".$kommentar."|";
$eintrag = str_replace (array ("\r\n", "\r", "\n"), array ("<br>", "<br>", "<br>"), $eintrag);
fwrite ($datei, $eintrag."\r\n");
fclose ($datei);
echo $danke;
}
else
{
include 'formular.php';
foreach (file($file) as $array)
{
$inhalt = explode('|', $array);
$drehen = array_reverse ($inhalt);
include 'gaestebuch.php';
}
}
$zeilen = count(file($file));
?>
---------------config.inc
<?php
$file = "eintraege.dat";
$maxeintraege = 10 ;
$danke = "Vielen Dank für Ihren Eintrag.<br>
<a href="index.php">Hier</a> können Sie Ihren Eintrag im Gästebuch lesen.";
?>
---------formular.php
<?php
echo "<html><head><form action="index.php" method="get">
<table width="520" cellspacing="2" cellpadding="2">
<tr>
<td valign="top"> </td>
<td>Alle Felder die mit einem kleinen * gekennzeichnet sind<br>
bitte auszufüllen.<br>
</td>
</tr>
<tr>
<td width="120" valign="top">Name: *</td>
<td width="395"><input name="name" type="text" id="name" size="35" maxlength="15"></td>
</tr>
<tr>
<td valign="top">E-Mail: *</td>
<td><input name="email" type="text" id="email" size="35" maxlength="40"></td>
</tr>
<tr>
<td height="24" valign="top">Titel: *</td>
<td><input name="titel" type="text" id="titel" size="35" maxlength="35"></td>
</tr>
<tr>
<td valign="top">Homepage:</td>
<td><input name="www" type="text" id="www" size="35"></td>
</tr>
<tr>
<td valign="top">Dein Eintrag: *<br>
".$html." </td>
<td><textarea name="kommentar" cols="60" rows="10" id="kommentar"></textarea></td>
</tr>
<tr>
<td> </td>
<td><br> <input type="hidden" name="action" value="senden">
<input type="submit" name="Submit" value="eintragen"></td>
</tr>
</table>
</form></body></html>";
?>
---------gaestebuch.php
<?php
echo "<html>
<body>";
echo "
<table width="300" cellspacing="0" cellpadding="0" border=\1" bordercolor="#000000">
<tr>
<td>name:</td>
<td>".$drehen[2]."</td>
</tr>
<tr>
<td>email:</td>
<td>".$drehen[1]."</td>
</tr>
<tr>
<td>kommentar:</td>
<td>".$drehen[0]."</td>
</tr>
</table></br>";
echo "</body>
</html>";
?>