rendered paste body<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.1 Transitional//EN">
<html>
<head>
<title>Vieraskirja</title>
</head>
<body>
<h2 style="background-color:yellow">Vieraskirja</h2>
<form action="<? echo $PHP_SELF?>" method="post">
Nimi:<br>
<input type="text" name="nimi" size="30"><br>
<br>Viesti:<br>
<textarea name="viesti" cols="30" rows=4></textarea><br>
<input type="submit" name="laheta" value="Lähetä">
<h3 style="background-color:silver">Viestit</h3>
<?php
$path="vieraskirja.txt";
if(isset($_POST['laheta']))
{
if(!$file=@fopen($path,"w")) {
echo "Tiedostoa ei voi avata";
}
else {
fwrite($file,date(d).".".date(m).".".date(Y) . " " . date(H).":".date(i).":".date(s)." ");
fwrite($file,"<b>".$_POST['nimi']."</b><br>\n".$_POST['viesti']."<br>");
fwrite($file, "<hr>"."\n\n");
fclose($file);
}
}
@include($path);
?>
</body>
</html>