Cee: Gästebuch bearbeiten

Beitrag lesen

Also gut, hier ist der Quellcode:

auswertung.php :

<?php

$kommentar = stripslashes ($kommentar);
$kommentar = trim ($kommentar);
$nname = stripslashes ($nname);
$nname = trim ($nname);
$hpage = stripslashes ($hpage);
$hpage = trim ($hpage);
$email = stripslashes ($email);
$email = trim ($email);

if (empty($kommentar))
{ echo "Du hast keinen Kommentar eingegeben.<br>";
echo "Klicke <a href="javascript:history.back()">hier</a>, um zum Formular zurückzukehren und die Fehler zu beheben."; }

else
if (empty($nname))
{ echo "Du hast deinen Namen nicht eingegeben.<br>";
echo "Klicke <a href="javascript:history.back()">hier</a>, um zum Formular zurückzukehren und die Fehler zu beheben."; }

else {
$i=1;
$gbfile=fopen("gbuch.txt","r");
while (!feof($gbfile)) {
$zeile[$i]=fgets($gbfile,10000);
$i++;
}
fclose($gbfile);

$nname2="Name: ".$nname."<br>";
if (!empty($email)) {
$email2="Email: <a href="mailto:".$email."">".$email."</a><br>"; }
else {
$email2=""; }
if (!empty($hpage)) {
$hpage2="Homepage: <a href="".$hpage."">".$hpage."</a><br>";
} else {
$hpage2=""; }

$j=1;
$gbfile=fopen("gbuch.txt","w");
fputs ($gbfile,"$nname2$email2$hpage2$kommentar<hr>\n");
while ($j<$i) {
fputs ($gbfile,"$zeile[$j]");
$j++;
}
fclose($gbfile);

echo "Die Daten wurden gesendet.";

echo "<a href="gaestebuch.php">Gästebuch erneut anschauen</a>"; }
?>

____________________________________________________________________

eintrag.php :

<FORM action="auswertung.php" method="post"><br>

<table>

<tr>
  <th><p>Name:</p></th>
  <th><input name="nname" size="35" style="float: left"><br></th>
 </tr>

<tr>
  <th><p>Email:</p></th>
  <th><input name="email" size="35" style="float: left"><br></th>
 </tr>

<tr>
  <th><p>Homepage:</p></th>
  <th><input name="hpage" size="35" style="float: left"><br></th>
 </tr>

<tr>
  <th><p>Kommentar:</p></th>
  <th><textarea name="kommentar" rows="6" cols="56"></textarea><br></th>
 </tr>
</table>

<table width="62%">
 <tr>
  <th width=50%><input type="submit" name="FERT" value="eintragen"></th>
  <th width=50%><input type="RESET" value=" löschen "><br></th>
 </tr>
</table>

</FORM>

___________________________________________________________________

gaestebuch.php :

<html>
 <head>
  <title>Gästebuch</title>

<style>
 .gross { color:chocolate3; font-family:Verdana; font-size:"14" }
 h1 { color:brown4; margin-left:150px }
 a:hover { color:red }
</style>

</head>
 <body>
<h1>Gästebuch</h1>

<p class="gross">Eintragen:</p>
<?php
require("eintrag.php");
?>
<hr noshade>
<br>
<p class="gross">Einträge</p>

<?php
include("gbuch.txt");
?>
 </body>
</head>

Ich verstehe ansich nicht sehr viel von PHP. Wer kann mir so helfen?