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.
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.
<?php
$flag_spam = 0;
$form_text = strip_tags(html_entity_decode($params['message'],
ENT_QUOTES, 'UTF-8'));
$text_spam_arr = array(
'/displays index\.php codes/i',
'/search engine friendly urls/i',
'/website urls have issues that needs to be addressed/i',
'/fed into Google\'s Product Search/i',
'/Your site may not be on Google Products Search/i',
'/make search engines your friend/i',
'/Ethical SEO/i',
'/SEO Report/i'
);
foreach ($text_spam_arr as $val) {
if ($flag_spam == 0) {
$flag_spam = preg_match($val,$form_text);
}
}
$flag_gmail =
preg_match('/\@gmail\.com/i',$params['your_email_address']);
if ($flag_spam == 1 && $flag_gmail == 1) {
header("Location:
https://mail.google.com/mail/help/program_policies.html");
} else if ($flag_spam == 1) {
header("Location:
http://business.ftc.gov/documents/bus61-can-spam-act-compliance-guide-business");
}
?>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.
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.