Spam-blocking techique for form submissions
An easy trick to keep site spammers at bay, for now.
When we ran MadisonMusicians.Net (since replaced by MusiciansConnect)I got a lot of spam classified ads. They don’t usually get posted, because the email validation is never completed. However, that generates a lot of bounced messages, and I got tired of deleting them from my inbox. The spam ads also fill up the database with useless data. I used a simple trick for form validation. On the form page, I added a field:
<input type=”text” name=”countryCode” style=”display:none;” />
I chose countryCode arbitrarily, it could be anything.
On the form action page that does the processing, I check to see if this field was filled in. Since its display is set to none, a human user would not see it and therefore not be able to fill it in. But an automated spammer would try to enter some data in it. In my validation, if the field is not equal to “”, I abort the form submission and redirect the user to a web page about spam.
-Ben Seigel, Owner, Versa Studio





©2012 Versa Studio LLC |