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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.