Battling the Bots: 2 Great Ways to Prevent Spam
Spam stinks. But the solution never be as bad as the problem. Captcha, one of the most widespread methods of letting humans in and keeping spambots out, can get annoying and even downright confusing, from words you can’t read to mysterious symbols you’ve never seen to images that won’t even load. Click here for an amusing compilation of some very bad examples.
Here are our two favorite alternative methods for fighting spam.
Easy Tasks
It isn’t exactly rocket science: simply create a very easy task for a user to complete. As long as it requires a human to understand the instructions, you’ve got a perfect spam filter.
For example, on a registration form, you can include a checkbox that is checked by default. Next to it, give the instruction: “Uncheck the box if you are a human.” Then mark any submissions in which the box has remained checked and let your email cull them out.
To accomplish this, include the following code in any HTML form:
<input type="Checkbox" name="spam_detector_2" value="!!!SPAM!!!" checked="checked" /> Uncheck the box if you are a human
If you receive website form submissions as emails (as most web hosts do), configure your email client to move emails marked !!!SPAM!!! to a separate folder or to delete them. Bye-bye, spam.
Hidden Fields
Here’s a great example of using those Homo Sapien smarts to outwit the bots. Spambots tend to enter information into any form field whether it is visible to the website’s human visitors or not. To exploit the evil computer’s weakness, a developer can use CSS to hide a particular field from view and add a bit of code so the system checks the hidden field for data. Any submission that has added information to the field is most likely spam, while human entries will leave the field blank.
Here’s the code, which is best added at the top of the form:
<input class="invisible" type="Text" name="spam_detector_3" />
<style type="text/css">
<!--
input.invisible {display:none;}
-->
</style>
Analyze the form data, redirect the offending submissions to the spam folder or to the trash, sit back, and revel in your victory over the machines.
Related links:

