for some reason a guestbook i coded in php gets spammed since about 1 week - app. 10 entries per day with content like this
cBlE3U
[URL=http://xxx-link]girls kissing girls[/URL]
[URL=URL=http://xxx-link]xxx words[/URL]
[URL=URL=http://xxx-link]xxx words[/URL]
[URL=URL=http://xxx-link]xxx words[/URL]
[URL=URL=http://xxx-link]xxx words[/URL]
i don't have the time to implement capatcha right now so here is a short work-around how i fixed it temporarily
original code
$id = time();
$name = addslashes($name);
$email = addslashes($email);
$homepage = addslashes($homepage);
$message = addslashes($message);
...
$pos = strpos($message,"[url");
$sqlcommand =
"INSERT INTO guestb (id, ...) VALUES ('$id', ...)";
mysql_query($sqlcommand)
or die("Error: " . mysql_error());
echo "thx for your entry";
modified code
$id = time();
$name = addslashes($name);
$email = addslashes($email);
$homepage = addslashes($homepage);
$message = addslashes($message);
...
$pos = strpos($message,"[url");
if ($pos === false) {
$sqlcommand =
"INSERT INTO guestb (id, ...) VALUES ('$id', ...)";
mysql_query($sqlcommand)
or die("Error: " . mysql_error());
}
echo "thx for your entry";
Read more...