Fighting Spam
Posted on Sun, 22 Apr 2007
at 13:29:44
Banning
I have added a simple bit of code right at the top of the index page to ban spammers from the site. The code is simply this:
<?php
// Stop any banned users from accessing site
$banned = array("xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx");
$index = 0;
while($index<=count($banned)) {
if($banned[$index] == $_SERVER['REMOTE_ADDR']) {
die("<h1 align=\"center\">YOU ARE BANNED!</h1>");
}
$index++;
}
?>
The code is simple, but it does the job. I record the IP of any person who posts a comment and then when I find a spammer I simply add their IP to the variable $banned and they can no longer access Dan Blog from that IP. It's brutal but it works - after 2 days it has lowered the level of spam I was receiving dramatically.Akismet
Akismet is a service free for use on personal web sites and is used on Wordpress, however it can be used on pretty much any blogging software out there - basically all it does is receives a comment to check (which you send to it's servers through an API), checks that comment for spam and then lets you know the result.
CAPTCHA
I would be very surprised if you had not seen an example of a CAPTCHA software in action whilst browsing the web - it is the software that asks you to copy random characters in an image in a text box to prove you are human - it works because computers can not decipher the characters in the image, and so stops spam bots from posting. It won;t work against humans, true, but that is what the banning and Akismet is for.
For an open source CAPTCHA program try freeCap by pureMango.
I have not yet implemented this software on this blog as I have been too busy with college, but it will be done shortly. I will post how easy I found it and how well it has worked.
There are 0 Comments Below | Add a Comment
Sorry, now there's advertising.
About
Dan (me) is now post college and looking to find his way in the world with a career in web design.
