Forum Spam Killer

PHP No Comments »

I was recently hired to do some custom programming work for a website and the site I was working on just happened to have a dicussion forum. As I was browsing around their forum I noticed it was completely overrun by forum spam. I thought this was a real problem so I asked the site owner about it and he said he knew about it but was simply too busy to do anything about it. I started doing some research online to see what could be done about it and I discovered this great site, StopForumSpam.com, which keeps an online database of known forum spammers. Their site allows you to search for a username, e-mail address, or ip address and will tell you if that person has spammed forums in the past. They also have an API you can integrate into your forum registration process and allow you to submit new spam data. You can also download their entire database in CSV format.

To help the site owner I was working with, I was looking for something that would allow him to easily delete all the spam in his forum with just the click of a button. I decided to write a small utility in PHP that would do the job and I call it "Forum Spam Killer". When you run the script it first downloads a list of ip addresses of known forum spammers from StopForumSpam.com then it cross-checks that list against the messages in your forum. When it finds a message posted by a matching ip address, it deletes the message and the user who posted it. Most of the script is self-explanatory, the only thing you have to remember to do is to set your MySQL server details in the PHP file and optionally add any ip addresses you don't want deleted to your whitelist. In my case, I found about 15 IP addresses that were listed on StopForumSpam.com that turned out not to be spammers.

Why am I getting the error message "MySQL Server Gone Away"?
If you press the Kill Forum Spam button and your MySQL server stalls or you get an error message that says something like "MySQL Server Gone Away" or "Packet Size too small" it means your max_allowed_packet size is too small. You need to increase it as per these instructions. In most cases, the script will attempt to do this for you if you have the right privileges. A size of 16mb or more is recommended in your my.ini or my.cnf file as shown below:

[mysqld]
max_allowed_packet=16M

Download it, use it as you like, enjoy!

Download forum_spam_killer.zip (August 03, 2009)

Visual Basic to HTML Converter

PHP No Comments »

Because I've been bringing a lot of my old Visual Basic code online recently I was looking for a way to easily display Visual Basic code on a webpage. I needed something that could take my existing Visual Basic code, convert it to HTML, apply color coding to it (which is technically called syntax highlighting), and then display it in valid XHTML. I was preferably looking for something written in PHP rather than relying on an external program, website, or VB Add-In. Since I couldn't find anything satisfactory on the web I decided to write my own.

Read the rest of this entry »

Entries RSS Comments RSS Log in