Excerpt: Everyone knows what Spam is. We all get unsolicited emails every day, and dealing with spam has never been a bigger battle.
Having a website that has any type of form means you are after opening a gate for spam.
Trying to close that gate and keep it close, for some people is a full-time job.
Below are some solutions that I found helpful:
1. Set a variable that will hold a number let's say 6.
Set-up a session on form submission and increase the count by one anytime the form gets submitted by the same user, then check to see if it's not equal or bigger then the variable you have set. If it is, display a message or redirect.
This is useful on contact forms.
2. On any other type of forms, like search, make sure you check the value of the submitted fields not to contain an email address
this can be easily done.
e.g using php:
if(eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_GET["field_name"])){
echo "You are not going to find an email address in the products table. Get real.";
die();
}
3. Limit the amount of data a user can type into the form field by using the input attribute maxlength="50".
You'll be surprised how much you can type into an input field that has no "maxlenght" applied.
e.g.If you have a qty. field for a product to be added to the shopping cart you can limit the amount of data to 3 - maxlenght="3".
Who would buy more then 999 products at a time?
4. Few months ago I was getting a lot of r
...
read more »
...















