Spam Prevention Techniques

This page contains HTML and JavaScript code for preventing email address from being harvested from your website, and PHP code to block form spam.

Email spam is a major problem for enterprises and individuals because it can lead to fraud, identity theft, computer viruses, and wasted time. In addition, misconceived efforts to block spam with overly aggressive filtering can inconvenience legitimate email contacts.

The following code (adapted from a post at HighRankings, and previously circulated on the web since time immemorable) can greatly reduce the amount of form spam. The idea is to place a CSS-hidden field on your form, and then test if it contains input. Spambots generally place input in every field. A human user will not fill out a hidden field. For added security you can label the hidden field “Leave Blank”.