3isico Forum Lid
1 posts |
# Geplaatst: 25 Jan 2010 09:45
Nu heb ik een jaar geleden een site gebouwd (www.felipe-muziek.nl) en alles was goed. Totdat ik gister bericht kreeg dat er gespammed wordt op het gastenboek. :(
Weet iemand hoe ik dat tegen kan gaan.
Alvast bedankt!!
PS: Het PHP gedeelte van het gastenboek bestaat uit 3 PHP-files.
*doorstuur.php
*lees.php
*schrijf.php
-----------------------------------------------------------------------
Dit is de inhoud van doorstuur.php:
<html>
<head>
<title>Gastenboek</title>
<script language="javascript">
function tijd()
{
setTimeout("lees()", 1500)
}
function lees()
{
document.location=("lees.php")
}
</script>
<?php
if(empty($_POST['naam']) || empty($_POST['bericht'])) {
echo("Je hebt je naam of bericht niet ingevuld <a href=schrijf.php>Klik hier</a> en probeer het nog eens");
} elseif (!isset($_POST['waar'])) {
echo("Je moet eerst iets invullen");
} else {
$naam=" ". $_POST['naam'] . " ";
$email=" ". $_POST['mail'] . " ";
$homepage=" ". $_POST['site'] . " ";
$bericht=" ". $_POST['bericht'] . " ";
$datum=date("d-m-Y");
$tijd=date("H:i");
function clean($naam, $email, $homepage, $bericht) {
$naam=strip_tags($naam);
$email=strip_tags($email);
$homepage=strip_tags($homepage);
$bericht=strip_tags($bericht);
$naam=htmlspecialchars($naam);
$email=htmlspecialchars($email);
$homepage=htmlspecialchars($homepage);
$bericht=htmlspecialchars($bericht);
return $naam;
return $email;
return $homepage;
return $bericht;
}
clean ($naam, $email, $homepage, $bericht);
$file = fopen ("gegevens.dat","a");
fputs ($file,"
<table width=460px cellpadding=0 cellspacing=0 border=0 margin=0px>
<tr height=10px width=450px border=0><td><FONT FACE=arial SIZE=1pt COLOR=white>$datum $tijd</FONT><br></td></tr>
<tr height=10px width=450px border=0><td><FONT FACE=arial SIZE=2pt COLOR=#434343><b>Naam:</b> $naam</FONT><br></td></tr>
<tr height=10px width=450px border=0><td><FONT FACE=arial SIZE=2pt COLOR=#434343><b>Email:</b> $email</FONT><br></td></tr>
<tr height=10px width=450px border=0><td><FONT FACE=arial SIZE=2pt COLOR=#434343><b>Homepage:</b> $homepage</FONT><br></td></tr>
<tr height=10px width=450px border=0><td><FONT FACE=arial SIZE=2pt COLOR=#434343><b>Bericht:</b> $bericht</FONT></td></tr>
<table width=460px height=7px><tr width=460px height=7px cellpadding=0 cellspacing=0 border=0><img src=Images/lijntje.jpg width=460px height=7px /></tr><td></td></table>
</table>
");
fclose($file);
}
?>
</head>
<body onLoad="tijd()" text="#434343" link="#EADA59" alink="#EADA59" vlink="#EADA59" face="arial" fontsize="3">
</body>
</html>
-----------------------------------------------------------------------
Dit is de php code van lees.php.
Deze code staat midden in een html bestand.
<?php
echo("<left>");
include("gegevens.dat");
?>
</div>
<div id="tekenen">
<a href="schrijf.php" target="_self">
<img src="Images/bt_sign_guestbook.jpg" name="teken" width="150" height="40" vspace="0" border="0" id="teken" /></a></div>
</div>
-----------------------------------------------------------------------
Dit is de php code in schrijf.php
Hier staat de php code verwerkt in een formulier
<div style= "position: relative; float: left; clear: left; width: 440px; height: 325px; z-index: 5; left: 250px; top: 265px;">
<!----------------------------------------------------------------------------------------------------------------------------------->
<form name="gastenboek" method="post" action="doorstuur.php">
<table width"479px" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="479px" height="40px">
<div align="right"><font face="arial" size="2" color="#434343">
* Naam:  </font></div> </td>
<td width="479px" height="40px">
<input type="text" name="naam" size="35" maxlength="70"> </td>
</tr>
<tr>
<td width="479px" height="40px">
<div align="right"><font face="arial" size="2" color="#434343">
Email:  </font></div> </td>
<td width="479px" height="40px">
<input type="text" name="mail" size="35" maxlength="100"> </td>
</tr>
<tr>
<td width="479px" height="40px">
<div align="right"><font face="arial" size="2" color="#434343">
Homepage:  </font></div>
<td width="479px" height="40px">
<input type="text" name="site" size="35" maxlength="100"> </td>
</tr>
<input type="hidden" name="waar">
<tr>
<td valign="top" width="479px" height="40px">
<div align="right"><font face="arial" size="2" color="#434343">
<br>* Bericht:  </font></div> </td>
<td width="479px" height="150px">
<textarea name="bericht" cols="27" rows="6" wrap="VIRTUAL"></textarea>
<font size=1 face="arial" color="#434343"><br>* Verplicht om in te vullen</font> </td>
</tr>
<tr>
<td colspan="2" width="479px" height="10px">
<div style= "margin-left: 138px; margin-top: 5px; align: left;"><font face="arial" size="2" color="#434343">
<input type="submit" name=submit value="Toevoegen" />
</font> 
<input type="reset" value="Invoer wissen">
</font></font> </div> </td>
</tr>
</table>
</form>
</div>
<div id="kader"></div>
<div id="lees"><a href="lees.php"><img src="Images/bt_lees_guestbook.jpg" border="0" /></a></div>
</body>
</html>
|