in men gastenboek wordt ik al geruime tijd gespamd door spambots die altijd links zetten naar p**nsite's en andere. Hoe kan je het best je tegen deze spambots beveiligen, want ik heb nu een IP ban op men GB maar dit helpt niet.
Ik heb captcha bij de GB gevoegd. Maar de spambots houden niet op.
Dit is gastenboek.php
<script src="include/scripts.js" type="text/javascript"></script>
<?php
//error_reporting(E_ALL);
$ip = $_SERVER['REMOTE_ADDR'];
//-- defineer tabelnaam
$table = "ip_blocks";
//-- bekijk de database of het IP adres ergens gevonden is
//-- dan heeft de bezoeker namelijk niet het recht om de
//-- pagina te bekijken..
$sqlip = "SELECT id FROM $table WHERE ip_adres = '$ip'";
$resip = mysql_query($sqlip);
//-- bekijk of er een resultaat is, zo niet, doe dan niets
if (mysql_num_rows($resip) >= 1)
{
//-- geef de block melding
echo "Jij kunt deze gastenboek niet zien.";
}
else
{
// Alternating row kleuren.
$color1 = "#222222";
$color2 = "#333333";
$row_count = 0;
// Het indelen in pagina's.
$max_b = "10";
$result = mysql_query("SELECT COUNT(id) FROM gastenboek");
$aantal = mysql_result($result, 0);
$paginas = ceil($aantal/$max_b);
// Als p ingesteld is, stel dan start waarde in.
if(isset($_GET['p'])) {
// Kijken of p nummeriek is.
if(is_numeric($_GET['p'])) {
$page = $_GET['p'];
$start = addslashes(($_GET['p']-1)*$max_b);
}
else {
$page = 1;
$start = 0;
}
}
else {
$page = 1;
$start = 0;
}
// Pagina links maken.
$p = "";
for($a = 1; $a <= $paginas; $a++) {
// Kijken of dit de huidige pagina is
if($page == $a) {
$p .= $a.' ';
}
// Is het dan niet dan word het een linkje
else {
$p .= '<a href="home.php?menu=gastenboek&p='.$a.'">'.$a.'</a> ';
}
}
// Haal de berichten op.
$sql_g = "SELECT * FROM gastenboek ORDER BY id DESC LIMIT ".$start." , ".$max_b."";
$res_g = mysql_query($sql_g);
echo "Welkom in het gastenboek<br /><br /><hr>";
echo "".$p."<hr>";
// Laat alle berichten zien.
if (mysql_num_rows($res_g) >= 1) {
echo "<table width=\"400\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
while ($row = mysql_fetch_array($res_g)) {
$bericht = $row['bericht'];
$g_datum = $row['datum'];
$g_auteur = $row['auteur'];
$g_email = $row['email'];
$row_color = ($row_count % 2) ? $color1 : $color2;
// Als er geen emailadres is, dan word er geen link gemaakt.
if(empty($g_email)){
$auteurmail = "".$g_auteur."";
}
else {
$auteurmail = "<a href=\"mailto:".$g_email."\">".$g_auteur."</a>";
}
// Het bericht.
echo "<tr><td style=\"border-bottom: 1px solid Black; padding: 5px\" bgcolor=\"$row_color\">";
echo "<b>".$auteurmail."</b> op ".$g_datum."<br />";
echo "".$bericht."<br /></td></tr>";
$row_count++;
}
echo "</table>";
}
else {
echo "Er zijn geen berichten in het gastenboek<br /><br />";
}
// Laat het formulier zien.
?>
<hr><br /><form method="post" name="addbericht" action="home.php?menu=gbtoevoegen">
<input type="hidden" value="<?php echo "".$ip."" ?>" name="ip">
Naam:<br /><input type="text" name="auteur"><br />
Email:<br /><input type="text" name="email"><br />
Bericht:<br /><table border="0" cellpadding="0" cellspacing="0"><tr><td><textarea rows="4" name="bericht" cols="22"></textarea></td><td style="width: 5px"></td>
<td><img style="margin: 1px; margin-left: 0px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':)')" src="files/images/smilies/smile.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':D')" src="files/images/smilies/biggrin.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':p')" src="files/images/smilies/tongue.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':(')" src="files/images/smilies/sad.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ';)')" src="files/images/smilies/wink.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':angry')" src="files/images/smilies/angry.gif" alt="Emoticon"><br />
<img style="margin: 1px; margin-left: 0px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':roll')" src="files/images/smilies/rolleyes.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':kiss')" src="files/images/smilies/kiss.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':cool')" src="files/images/smilies/cool.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':cry')" src="files/images/smilies/cry.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':huh')" src="files/images/smilies/huh.gif" alt="Emoticon">
<img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.addbericht.bericht, ':omg')" src="files/images/smilies/omg.gif" alt="Emoticon"><br /><br />
<a href="javascript:popup('include/bbcode.html')">BBcode</a> is ON<br />HTML is OFF</td></tr></table><br />
Typ dit over: <img src="include/captcha_image.php" />:<br /><input type="text" name="captcha_input" size="15" /><br />
<input type="submit" value="Verzenden" name="submit">
</form>
<?
}
?>
en dit is bericht.php
<script src="scripts.js" type="text/javascript"></script>
<?php
// Include de functies (BBcode, Mailcheck).
include('functies1.php');
if ($_SERVER["REQUEST_METHOD"] <> "POST")
die("Je kan dit bericht niet posten.");
// Als het formulier is verzonden, voeg reactie toe in database.
// *** The text input will come in through the variable $_POST["captcha_input"],
// while the correct answer is stored in the cookie $_COOKIE["pass"] ***
if ($_POST["captcha_input"] == $_SESSION["pass"])
{
// *** They passed the test! ***
// *** This is where you would post a comment to your database, etc ***
//echo "Correct! Youve passed the captcha test. <br><br>";
//echo "Your Message: \"" . $_POST["message"] . "\" would be posted if ";
//echo "this example was fully functional";
// Als auteur leeg is, Auteur is anoniem.
if(empty($_POST['auteur'])) {
$auteur = "Anoniem";
}
else {
$auteur = htmlspecialchars($_POST['auteur']);
}
// Als er geen reactie is geschreven, geef melding en vermoord script.
if(empty($_POST['bericht'])) {
echo "Je moet een bericht schrijven! Klik <a href=\"home.php?menu=gastenboek\">hier</a> om terug te gaan";
die();
}
else {
$bericht = bbcode($_POST['bericht']);
}
// Check of het email adres klopt.
if(checkmail($_POST['email']) == "true") {
$email = $_POST['email'];
}
else {
echo "Je hebt een vals email adres ingevuld! Klik <a href=\"home.php?menu=gastenboek\">hier</a> om terug te gaan";
die();
}
$ip = $_POST['ip'];
$datum = date("d-m-Y");
$tijd = date("H:i:s");
$datumtijd = "".$datum." om ".$tijd."";
// De mysql query om de reactie in db te zetten.
$insert = mysql_query("INSERT INTO gastenboek (ip, auteur, bericht, email, datum) VALUES ('$ip', '$auteur', '$bericht', '$email', '$datumtijd')");
// Als $insert lukt, geef melding, anders geef error
if($insert) {
echo "Uw bericht is succesvol toegevoegd, klik <a href=\"home.php?menu=gastenboek\">hier</a> om terug te gaan";
}
else {
echo "Er is iets misgegaan, uw bericht is niet toegevoegd";
}
}
else {
// *** The input text did not match the stored text, so they failed ***
// *** You would probably not want to include the correct answer, but
// unless someone is trying on purpose to circumvent you specifically,
// its not a big deal. If someone is trying to circumvent you, then
// you should probably use a more secure way besides storing the
// info in a cookie that always has the same name! :) ***
echo "Er is iets mis gegaan<br><br>";
}
?>
Wat doe ik verkeerd?
Plzz help mij, elke dag 2pagina's spam verwijderen.
Ik heb een vrij druk gastenboek (op dit moment zo'n 10 berichtjes per uur ofzo), en nog nooit geen last gehad van spam.
Captcha systemen vind ikzelf niet relaxed, mensen die niet goed bekend zijn met internet zullen het niet snel snappen. Echter... wat bij mij goed werkt is simpelweg een emailtje sturen naar de gebruiker en vragen zijn post te activeren.
Kost de eindgebruiker een extra stap, maar het werkt prima :).