RSS Feed


SEO Contact Form SPAM from Gmail Addresses

SEO Contact Form SPAM from Gmail Addresses
Posted on Feb 29, 2012 by Stephen Owens
Tutorial and Code category
   [ Return ]

A quick PHP script to stop all those unwanted SEO spam messages, being submitted by your own Contact Us form.

A growing trend for SPAM is to hire people to fill in the contact us forms on websites.

There must be some kind of Get Rich Quick Selling Spammy SEO ebook out there. It's always the same basic message and wording.

PHP Example of the Contact Form SEO Spam Killer

Based upon the stock messages they send, I have elimited the SEO spam being sent via my contact web form with this little script. Feel free to take the following concept and fit it to your needs. 

  1. <?php
  2. $flag_spam = 0;
  3. $form_text = strip_tags(html_entity_decode($params['message'], 
  4. ENT_QUOTES, 'UTF-8'));
  5. $text_spam_arr = array(
  6. '/displays index\.php codes/i',
  7. '/search engine friendly urls/i',
  8. '/website urls have issues that needs to be addressed/i',
  9. '/fed into Google\'s Product Search/i',
  10. '/Your site may not be on Google Products Search/i',
  11. '/make search engines your friend/i',
  12. '/Ethical SEO/i',
  13. '/SEO Report/i'
  14. );
  15. foreach ($text_spam_arr as $val) {
  16.   if ($flag_spam == 0) {
  17.     $flag_spam = preg_match($val,$form_text);
  18.   }
  19. }
  20. $flag_gmail =
  21. if ($flag_spam == 1 && $flag_gmail == 1)  {
  22.   header("Location:
  24. } else if ($flag_spam == 1)  {
  25.   header("Location:
  27. }
  28. ?>

Why Not a Mail Filter in my Email Client?

I could have setup a mail filter in my email client to push all this stuff to my trash folder. However, I find it a great deal more satisfying to send these people away.

The Web is Talking about SEO Contact Form Spam

If you know of any other interesting articles about SPAM via contact forms. Please leave a comment below. Here are some of the things I've found about it.

A Message to the SEO Spammers

I'm tired of people using the contact form on all my websites to send me Search Engine Optimization spam using a ficticious name and a gmail account. No I don't need your spamy flavored SEO services. 

So when you are redirected. Read the information that is provided by the FTC and/or Google.

Like what you read? Get updates for free!
comments powered by Disqus