<?
$path = "/home/www/pub/fh1000/huecker.com/msw/php/samples/gb";
$file = "$path/.gb.count";
if ( file_exists ( $path ) == 0 ) { mkdir ( $path, 0777 ); };
if ( file_exists ( $file ) == 0 ) { touch ( $file ); };
if ( isset($name) == 0 || isset($email) == 0 || isset($note) == 0) {
echo ( "<form action=gb_input.php method=post>" );
echo ( "<p>Bitte geben Sie Ihren Namen ein." );
echo ( "<br><input type=text name=name size=30 maxlength=30>" );
echo ( "<p>Ihre E-Mail Adresse." );
echo ( "<br><input type=text name=email size=30 maxlength=30>" );
echo ( "<p>Ihr Beitrag zu unserem Gästebuch." );
echo ( "<br><textarea name=note rows=6 cols=43 wrap=virtual></textarea>" );
echo ( "<p><input type=reset value=Cancel><input type=submit value=Senden>" );
echo ( "</form>" );
} elseif ( $name == "" || $email == "" || $note == "" ) {
echo ( "Bitte Eingabefelder ausfüllen. | <a href=\"javascript:history.back()\">Korrektur</a>" );
} else {
$fp = fopen($file, 'r+');
flock ($fp, LOCK_SH);
$count = fread($fp, 4096);
rewind ( $fp );
fwrite($fp, ++$count);
fflush ($fp);
flock ($fp, LOCK_UN);
fclose($fp);
$note = str_replace("\x0d", "<br>", $note);
$note = str_replace("\n", "", $note);
$fp = fopen ( "$path/$count.dat", 'w' );
fwrite ( $fp, time() . "\n" ); // . Gästebuch schreiben
fwrite ( $fp, "$name\n" ); // . Gästebuch schreiben
fwrite ( $fp, "$email\n" ); // . Gästebuch schreiben
fwrite ( $fp, "$note" ); // . Gästebuch schreiben
fclose ( $fp );
echo ( "<p>Danke für Ihren Beitrag. | <a href=\"/project/manual/php_man_j.shtml\">Exit</a>" );
exit;
};
?>