PHP Spam Blocking Tips and Tricks

KeyWords: PHP Spam Blocking Tips and Tricks

PHP Spam Blocking Tips and Tricks
by FrosT

Spam Blocking is soon enough becoming an art. Everyone tries to block spam but the hard issue is, how is an entry deemed spam? Well in this article I will explain some tips and tricks with programming and coding in PHP on how to block those spammers. Note that this trick will not always work but so far as worked for 98% of the time. Enough of chit chat onto the PHP Spam Blocking Tips and Tricks.

Block those Spammers
Blocking spammers is a technique that has taken many years of coding and programming to figure out a decent way. Recently the way I have been monitoring spam posts is gathering the complete text with server variables and trying to find a uniqueness in them all. First attempt at blocking spam I tried was making a "spam" list of common sites found in Spam posts. This works good, but spammers have too many urls and it would fill up probably 2 or 3mbs of just websites blocked. Now I have all these server variables, cookies, and POST data from these spammers I use code to figure out a common between them. Well after I received all those spam data with the variables I needed some data to compare it to. Next I monitored just regular user's comments. Server variables and everything to figure out how their posts work.

Compare and Contrast in the Programming world is essential. With PHP it makes it easy, at least for me. Using PHP to filter through all these posts (100's of them) I came across a common denomiator. Refferer Check. Well this refferer check only worked for a few months until the spammers figured out how we were blocking them with PHP. Back the the drawing board. By this time I had realized something in the PHP Server Variables code, cookies!

Cookies with Spam
Cookies are very delicious but not the kind we are talking about today. The cookies we are talking about are website cookies. Looking closely at the cookies in PHP a common denominator was found, SPAMMERS do not have website set cookies! With the glory of PHP I confirmed this accusation. After it was confirmed I coded a cookie check in PHP and set a cookie for every single page on Aeonity Free Blog. After a week of making sure it was only spammers that do not have the cookie set I was satisfied and put it live. To Date my PHP Anti-Spam cookie check code has blocked over 400 spammed messages and it has only been in the works for 2 days!

Spammers are Lazy
Spammers are very lazy. They have to program bot scripts to do their dirty work for them. Because these are scripts ran on the spammers servers they have to falsify information. When the spammers figure out about the cookie check, maybe then I have to move onto my next idea for blocking spam. This idea I will hold off till a later time. One rule of thumb for any programming language is do not give away your ideas too soon. Especially with PHP, it will be out in the open faster than you can say, snot on a shingle.

Ending Notes
I have never met a person who enjoys Spam. I sure as hell do not enjoy spam especially when it is spamming my own programs and software I programmed. That is why I love PHP it is easy to work with and figure out data that in other languages it would be very hard to. With the simplicity of programming PHP I have learned these Tips and Tricks to succesfully blocking Spam!

Posted by frost on Jan 19th, 2006 17:32 - Subscribe Bookmark and Share

Post a comment:


Posting as anonymous Anonymous guest, why not register, or login now.

Posted by david on January 21st, 2006

You did an awesome job on Aeonty's Spam Blocker. Keep up the great work.

Posted by anonymous on May 13th, 2007

That image check for comments is a great idea!

Posted by frost on May 13th, 2007

Yea, it may change here in here in the future to a different type of verification.




  • Not Implemented