<
html>
<head>
<meta http-equiv="Content-Type" content="text/
html; charset=windows-1252" x-undefined>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<?php
$forumdb="forum.txt";
if(!file_exists($forumdb)) {
$fp=fopen($forumdb,"w");
fclose($fp);
}
if(isset($abschicken)) {
$fpn=@fopen($forumdb.".tmp","w");
if($fpn<=0) {
?>
Fehler[color=red]: Datei konnte nicht geöffnet werden (w)[/color]
<?php
} [color=red]else {[/color]
$text=htmlspecialchars($text);
$datum=date("d.m.Y H:i:s");
$eintrag="<tr><td>$text</td></tr>";
$eintrag.="<tr><td><font size='-1'>$name, $email $datum</font></td></tr>";
$eintrag.="<tr><td><hr></td></tr>\n";
fputs($fpn,$eintrag);
$fp=@fopen($forumdb,"r");
if($fp<=0) {
?>
Fehler[color=red]: Datei konnte nicht geöffnet werden (r)[/color]
<?php
} [color=red]else {[/color]
while(!feof($fp)) {
$zeile=fgets($fp,32000);
fputs($fpn,$zeile);
}
fclose($fp);
fclose($fpn);
unlink($forumdb);
rename($forumdb.".tmp",$forumdb);
}
[color=red]}
}[/color]
?>
<body>
<center>
<h1>Gästebuch</h1>
<table border="0">
<form action="gaestebuch.php" method="POST">
<tr>
<td align="RIGHT">Name:</td><td><input type="Text" name="name" size="30" maxlength="255"></td>
</tr>
<tr>
<td align="RIGHT">E-Mail:</td><td><input type="Text" name="email" size="30" maxlength="255"></td>
</tr>
<tr>
<td align="RIGHT">Text:</td><td><textarea type="Text" name="text" cols="30" rows="10"></textarea></td>
</tr>
<tr>
<td colspan="2" align="CENTER"><input type="Submit" name="abschicken" value="Abschicken"></td>
</tr>
</form>
</table>
<table border=0>
<tr>
<td>
<?php include($forumdb); ?>
</td>
</tr>
</table>
</center>
</body>
</
html>