View Full Version : Catching spam messages

Retired Bill
08-20-2007, 07:17 PM
I have a few spammers to my site that always start their message in the comment section with the words Hi, or Hello, or Greetings. I am trying to discourage them from visiting my site by rejecting their message and requiring them to reenter the comment. I am using the following code, but it seems to be ineffective. It detects words such as "history" and "this" as matching "hi."

#display a message and redisplay the form if message appears to be spam
elseif( eregi('((hi)|(hello)|(greetings))', $comments))
$msg = "<b>ERROR in submitting data!.</b><br /><br />";
$msg.= $form;

Any thoughts or suggestions? I'm kind of new to this. Thanks.

08-20-2007, 07:20 PM
I would suggest that you use a CAPTCHA with every form on your website. Here is a url that demonstrates how to use CAPTCHAs


08-20-2007, 09:15 PM
I've had great success just blocking anything with a URL in it, since 100% of the spam I get through web-forms contains a url of some sort... otherwise what would be the point - aside from general annoyance? Then my error page instructs real users to obfuscate urls if they want to send me a link through my contact page.