Ik zet de code erbij zoals die dus niet werkt. Is er iemand die me kan vertellen hoe die wel werkt?
<?
$amount=50;
if ($_GET['action']=='write') {
$file=fopen('gastenboek.txt','a');
$message = str_replace(array("\r\n","\r","\n"), '<br />',stripslashes ($_GET['message']));
fwrite($file,$message."\n");
fclose($file);
header('location: gastenboek.php?action=read&start=0');
}
$start=(isset($_GET['start'])?$_GET['start']:0);
$gastenboek=Array();
$gastenboek=file('gastenboek.txt');
?>
<style>
#message{
width: 100%;
height: 80px;
font-family: Arial;
overflow: auto;
}
TD, textarea {
font-family:Arial;
font-size: 1em;
}
a {text-decoration: none;
} a:hover { text-decoration: underline;
} a:active {text-decoration: none;
} a:archive {text-decoration: none;}
</style>
<HTML>
<HEAD>
<TITLE>Gastenboek</TITLE>
<!--
Gebruik de volgende script tag als je het SUR-script van CoR.nl wilt gebruiken
<SCRIPT language="JavaScript" src="sur.js" type="text/javascript"></SCRIPT>
Verwijder dan ook de twee slashes (//) in de onLoad van de BODY-tag
-->
<SCRIPT language="JavaScript">
function validate(form) {
if (form.name.value=="") {
alert("Vul je naam in");
return false;
} else if (form.message.value=="") {
alert("Vul je bericht in");
document.getElementById('message').focus();
return false;
}
}
</SCRIPT>
</HEAD>
<body onload="document.getElementById('message').focus()" topmargin="40" bgcolor="#000000" background="/images/backgrnd1.gif" leftmargin="20" topmargin="40">
<center>
<TABLE width="748" cellspacing="0" cellpadding="0">
<tr><td align="center"><INPUT TYPE=button VALUE="Button"
onClick="location.href='index.htm'" style="font-family: Arial" title="Go to the main page">
</td></tr>
</TABLE>
<img border="0" src="images/spacer.gif" width="1" height="25">
<TABLE width="748" style="border-style:solid; border-width:1; border-collapse: collapse" cellpadding="20" cellspacing="0" id="AutoNumber1" bordercolor="#000000" bgcolor="#FFFFFF">
<TR><TD class="conttd">
<FORM action="gastenboek.php" method="GET" onSubmit="return validate(this);">
<INPUT type="hidden" name="action" value="write">
<TEXTAREA name="message" id="message" cols="85" rows="5" style="border-collapse: collapse; border: 0px solid #000000;"></TEXTAREA></TD></TR>
<tr><td align="right"><INPUT type="submit" style="font-family: Arial" size="3" value="Verstuur" title="Klik hier om je bericht te plaatsten"></TD></TR>
</FORM>
</TD></TR>
</TABLE>
<img border="0" src="images/spacer.gif" width="1" height="20">
<TABLE width="748" cellspacing="0" cellpadding="0">
<tr><td><img border="0" src="images/spacer.gif" width="1" height="20"></td></tr>
<tr>
<td valign="middle" style="border-style:solid; border-width:1; border-collapse: collapse" bordercolor="#000000" bgcolor="#FFFFFF">
<img border="0" src="images/spacer.gif" width="1" height="10">
<CENTER>
<?
if ($start+$amount<sizeof($gastenboek)) echo ' <b><A href="gastenboek.php?start='.($start+$amount).'"style="text-decoration: none"><font color="#000000">vorige</A>';
if ($start>0) echo '<A href="gastenboek.php?start='.max(0,$start-$amount).'"style="text-decoration: none"><font color="#000000"> volgende</b></A>';
?>
</CENTER>
<img border="0" src="images/spacer.gif" width="1" height="10">
</TD>
</TR>
</TABLE>
<TABLE width="748" cellspacing="0" cellpadding="20" style="border-style:solid; border-width:1; border-collapse: collapse" bordercolor="#000000" bgcolor="#FFFFFF">
<tr>
<td>
<TABLE BORDER= "0" cellspacing="0" cellpadding="0" style="font-family:Arial;" "border-style:none border-collapse: collapse" bgcolor="#FFFFFF">
<tr>
<td>
<?
$gastenboek=array_reverse($gastenboek);
for ($i=$start;$i<$start+$amount && $i<sizeof($gastenboek);$i++) {
list($name,$email,$date,$url,$message)=explode('|||',$gastenboek[$i]);
$message=str_replace('{{',"\n",$message);
echo '<TR><TD>'.($email!=""?'<A href="mailto:'.$email.'">'.$name.'</A>':$name).'</B></TD><TD align="right"></B> </FONT> '.$date.'</B></P></TD></TR>'."\n";
echo ($url!=""?'<TR><TD colspan="2"><A href="'.$url.'" target="_blank">'.$url.'</A></TD></TR>':'')."\n";
echo '<TR><TD colspan="2"><SPAN class="SUR">'.str_replace("\n",'<BR>' ,htmlspecialchars($message)).'</SPAN></TD></TR>'."\n";
echo '<TR><TD colspan="2"><HR NOSHADE color="#000000" size="1"></TD></TR>'."\n";
}
?>
</td>
</tr>
</TABLE>
</td>
</tr>
</TABLE>
<TABLE width="748" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" style="border-style:solid; border-width:1; border-collapse: collapse" bordercolor="#000000" bgcolor="#FFFFFF">
<img border="0" src="images/spacer.gif" width="1" height="10">
<CENTER>
<?
if ($start+$amount<sizeof($gastenboek)) echo ' <b><A href="gastenboek.php?start='.($start+$amount).'"style="text-decoration: none"><font color="#000000">vorige</A>';
if ($start>0) echo '<A href="gastenboek.php?start='.max(0,$start-$amount).'"style="text-decoration: none"><font color="#000000"> volgende</b></A>';
?>
</CENTER>
<img border="0" src="images/spacer.gif" width="1" height="10">
</TD>
</TR>
</TABLE>
<img border="0" src="images/spacer.gif" width="1" height="40">
<TABLE width="748" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><INPUT TYPE=button VALUE="Button"
onClick="location.href='index.htm'" style="font-family: Arial" title="Go to the main page">
</td>
</tr>
</TABLE>
<img border="0" src="images/spacer.gif" width="1" height="25">
</center>
</BODY>
</HTML>