Jump to content

Will this spam filter prove useful or will it not work at all?


TeroYukio

Recommended Posts

comment.php

 

$a = RAND(1,20);
$b = RAND(1,20);
$c = $a + $b;

echo "<input type=\"hidden\" value=\"$c\" id=\"botcheck\" name=\"botcheck\">";
echo "<div class=\"typeof\"><b>Spam Filter:<br>$a  +  $b  = ?</b></div><div><input type=\"text\" id=\"botcheckanswer\" name=\"botcheckanswer\"></div><br>";

 

addcomment.php

 

if($_POST['botcheck'] != $_POST['botcheckanswer']){
echo "You have failed the spam filter. Please try again.";
}else....

 

The coding works fine, if you enter in the correct sum then it will post, if not it will fail to post.  My question here is it too basic and will bots get past this line of defense?

Well you could use something like cURL to read the page first, get the value of that hidden field and then just enter it into the answer, so that solution may fall over. You might want to consider storing the answer in a session instead.

Also, if there is one thing that computers does better than us humans, then it's mathematics.

 

Still not quite understood the idea behind using mathematics to "prove" ones humanity. Reading comprehension is a much better criteria, seeing as that is something computers cannot emulate.

It wouldn't take much to beat that. Computers can do math.

 

The only way to answer this though is to implement it. It will prevent less-sophisticated SPAM bots from submitting forms. If you find you're getting SPAM through it, it's time to upgrade to something like CAPTCHA

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.