<?
$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');
?>
<HTML>
<HEAD>
<TITLE>Gastenboek</TITLE>
<!--
<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>
<style>
#message{
width: 100%;
height: 80px;
font-family: Arial;
font-size: 8pt;
overflow: auto;
background-color:"#00FF00";
}
textarea{
font-family:Arial;
font-size: 8pt;
font-weight: bold;
background-color:"#00FF00";
}
TD{
font-family:Arial;
font-size: 10pt;
font-weight: bold;
background-color:"#00FF00";
}
a.type1:link {
text-decoration:none; font-weight: normal; color:blue;
}
a.type1:visited {
text-decoration:none; font-weight: normal; color:blue;
}
a.type1:active {
text-decoration:none; font-weight: normal; color:blue;
}
a.type1:hover {
text-decoration: underline; font-weight: normal; color:blue;
}
</style>
</HEAD>
<body onload="document.getElementById('message').focus()" topmargin="40" leftmargin="20" topmargin="40" bgcolor="#CCFFCC">
<center>
<INPUT TYPE=button VALUE="Button"
onClick="location.href='index.htm'" style="font-family: Arial" title="main page"><br>
<img border="0" src="images/spacer.gif" width="1" height="20">
<TABLE width="748" style="border-style:solid; border-width:1; border-collapse: collapse" cellpadding="20" cellspacing="0" id="AutoNumber1" bordercolor="#000000">
<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; font-weight:normal" size="3" value="Verstuur" title="Sent"></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 valign="middle" style="border-style:solid; border-width:1; border-collapse: collapse" bordercolor="#000000">
<img border="0" src="images/spacer.gif" width="1" height="10">
<CENTER>
<?
if ($start+$amount<sizeof($gastenboek)) echo ' <a title="previous messages" class="type1" href="gastenboek.php?start='.($start+$amount).'">vorige</A><img border="0" src="images/spacer.gif" width="18" height="1">';
if ($start>0) echo '<a title="next messages" class="type1" href="gastenboek.php?start='.max(0,$start-$amount).'">volgende</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">
<tr>
<td>
<TABLE BORDER= "0" cellspacing="0" cellpadding="0" style="font-family:Arial;" "border-style:none border-collapse: collapse">
<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">
<img border="0" src="images/spacer.gif" width="1" height="10">
<CENTER>
<?
if ($start+$amount<sizeof($gastenboek)) echo ' <a title="previous messages" class="type1" href="gastenboek.php?start='.($start+$amount).'">vorige</A><img border="0" src="images/spacer.gif" width="18" height="1">';
if ($start>0) echo '<a title="next messages" class="type1" href="gastenboek.php?start='.max(0,$start-$amount).'">volgende</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">
</center>
</BODY>
</HTML>
655 views
In Firefox worden de instellingen voor de TD en textarea etc, zoals opgenomen in de <STYLE> niet weergegeven. In IE werkt het allemaal wel. Weet iemand waar dit aan ligt.