Next entry >>
Categories: Internet , Programming

I unfortunately receive spam attempts to all of my email form systems, be it this website, a clients site, or especially genpets.com

blocking via keywords is nice, but nowadays spammers simply use groups of non coherent words.

here's a useful way to implement a block, depending on what sort of site you run it might work great.

generally no one sends me links via legitimate email on my forms, sometimes one or two. but never 5-7!

so it seems to make sense to count how many links are in a body of text, and then block the email if there's more than, in my case 5.

here's is the code below.

//check for link spam

preg_match_all("/http/i",$Message,$matches);

$cnt = count($matches[0]);

if($cnt >=5){$errors[] = "Email Spam detected! Please do not try again, your IP has been logged.";

}

obviously switch the IF to what you need, but I use an error array and only send if the array is empty.

this is not an end all be all approcah, but it should cut down on the amount coming through, and if combined with IP logging and keywords should be close to 100% successful.

 
| Newest comments last| Back


Add a Comment

Comments must first be APPROVED before they are publicly viewable.
*Name:
Email:
(Hidden)
url:
*Comments:
  Remember my details
*Verify:
 
Please type the verification string for security purposes.
(* Required).
Line breaks and paragraphs are automatically converted
All HTML tags will be removed.
Comment Preview
says:

Posted on Wednesday February 08, 2012 @ 02:52am


Page 1 of 1