TeroYukio Posted August 10, 2012 Share Posted August 10, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/266912-will-this-spam-filter-prove-useful-or-will-it-not-work-at-all/ Share on other sites More sharing options...
Porl123 Posted August 10, 2012 Share Posted August 10, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/266912-will-this-spam-filter-prove-useful-or-will-it-not-work-at-all/#findComment-1368384 Share on other sites More sharing options...
TeroYukio Posted August 10, 2012 Author Share Posted August 10, 2012 I hate to be a bother, but I am not great at coding...I do it because I enjoy it. With that being said, how would I go about storing it into a session instead? Quote Link to comment https://forums.phpfreaks.com/topic/266912-will-this-spam-filter-prove-useful-or-will-it-not-work-at-all/#findComment-1368387 Share on other sites More sharing options...
Christian F. Posted August 10, 2012 Share Posted August 10, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/266912-will-this-spam-filter-prove-useful-or-will-it-not-work-at-all/#findComment-1368388 Share on other sites More sharing options...
Porl123 Posted August 10, 2012 Share Posted August 10, 2012 Yeah, perhaps a question relating to sentence structure. It's not fool proof, but it's not as innate in computers to understand. Quote Link to comment https://forums.phpfreaks.com/topic/266912-will-this-spam-filter-prove-useful-or-will-it-not-work-at-all/#findComment-1368389 Share on other sites More sharing options...
xyph Posted August 10, 2012 Share Posted August 10, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/266912-will-this-spam-filter-prove-useful-or-will-it-not-work-at-all/#findComment-1368392 Share on other sites More sharing options...
TeroYukio Posted August 10, 2012 Author Share Posted August 10, 2012 Thanks for the replies guys, I'll try working on something a little more sophisticated and see what I can turn up with. Quote Link to comment https://forums.phpfreaks.com/topic/266912-will-this-spam-filter-prove-useful-or-will-it-not-work-at-all/#findComment-1368395 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.