Our guestbook has been attacked by spam bots quite a bit recently and I finally got around to stopping the spam with a neat little trick from the ASP.NET AJAX Control Toolkit that real users won’t even notice (as long as they have Javascript enabled…)
A lot of spam bots don’t execute javascript so you are safe from them. For people that disable javascript, you can modify the above code to do something like…
And that will allow regular people that have javascript enabled to not be bothered by proving they’re human while also allowing for the occasional user that disables it.
Disclaimer: It has been a while since I’ve wrote any PHP so I can’t guarantee any of that PHP code will work.
This change fixes the single equals sign operator error, as well as added in a strtolower() command, so that if the user inputs Thirteen or tHirTeeN you know they still had the right answer.
Thanks artdutra, I’ve been doing too much with VB.NET and SQL at work lately, I kept starting to type “OR” instead of “||” also but managed to catch all of those mistakes.
I was thinking about the spam blocking code a minute ago and think there may actually be a better way to do the thing…
I also caught another error when I actually tested that before posting… I had used apostrophes in my PHP strings and had one in “You’re”, switched that string to quotation marks.