Here is a simple sample (guestbook):
Output like this:
<?php
include("domain\cgi-local\guestbook.txt"); ?>
Input via a form.
<?php
$gbuch="guestbook.txt";
if (!file_exists($gbuch)){
$igbuch = fopen($gbuch,"w");
fclose ($igbuch);
}
if (isset($name)){
$tmpgbuch = @fopen($gbuch.".tmp","w");
if ($tmpgbuch <= 0) {
?>
Zugriffsfehler auf dem Server, bitte versuchen Sie es nochmal.
<?php
}
$text = ereg_replace( " ", "<br>", $text );
$text = htmlspecialchars($text);
$datum = date("d.m.Y H:i:s");
$eintrag= "<pre><font face=\"Verdana,Geneva\" size=\"2\"><B>Name:</B> $name<BR>";
$eintrag.="<B>Email: </B><A HREF = \"mailto:$email\">$email</A><BR>";
$eintrag.="<B>Datum:</B> $datum<BR>";
$eintrag.="<B>Kommentar:</B><blockquote><br>$text</blockquote>\n<HR width=\"75%\"></font></pre>";
fputs($tmpgbuch, $eintrag);
$igbuch = @fopen($gbuch, "r");
if ($igbuch <= 0) {
?>
Zugriffsfehler auf dem Server, bitte versuchen Sie es nochmal.
<?php
}
while(!feof($igbuch)){
$zeile = fgets($igbuch, 32000);
fputs ($tmpgbuch, $zeile);
}
fclose($igbuch);
fclose($tmpgbuch);
unlink($gbuch);
rename($gbuch.".tmp", $gbuch);
}
?>