Fight the spammers
In the first few weeks of my website’s existence, the spam machine left my website alone. But as soon as my site got linked on various webpages around the world. The spam started to slip in. Online casinos, free slot machines and oh-so-hot girls.
There had to be something to quickly protect my site against spam. I know captcha works quite well, but the problem with captcha is that users always have to read unreadable images. These impossible captchas annoy the hell out of me, so that was out of the question.
I know Wordpress has a nice plugin called Akismet which is filtering spam quite good. I’ve been using it for some time on my DS article site, and it has been filtering a lot of spam.
Here are the things I used to filter spam:
I already had the Wordpress API key because of my DS blog. You can also use one if you already have a Wordpress blog.
The main thing you need to do in order to filter spam content is to let Akismet check the content of the posted data. This can be for comments, short messages or just any content a user is able to post.
include('/path/to/akismet/class.php');
$WordPressAPIKey = 'aoeu1aoue';
$MyBlogURL = 'http://www.example.com/blog/';
$akismet = new Akismet($MyBlogURL ,$WordPressAPIKey);
$akismet->setCommentAuthor($name);
$akismet->setCommentAuthorEmail($email);
$akismet->setCommentAuthorURL($url);
$akismet->setCommentContent($comment);
$akismet->setPermalink("http://www.example.com/blog/alex/someurl/");
if($akismet->isCommentSpam()) {
// store the comment but mark it as spam (in case of a mis-diagnosis)
} else {
// store the comment normally
}
It’s just that easy! Include the PHP class, set some parameters and let Akismet do the checking.
Be sure to store the spam also! Sometimes regular messages can be marked as spam, which is a bad thing. I just used an easy field in my comments table to mark it as spam or a normal message.
If you want to implement Akismet on another platform you should check out: http://akismet.com/development/
Good luck giving the finger to spam without Captcha!
Articles like this one
5 Comments
-
Akismet is nice, not flawless though. Installed it before but some stuff kept coming through. On the other hand, it did filter quite a bit.
-
It works fine for me. Spam doesn’t seem to be getting the best of me anymore. The script has matured very much!
-
I agree with Pim.
Akismet stops automated scripts, but also stops “regular comments” (called ham) that have an URL.
Also, it doesn’t stop comment from actual people that contain only smileys.
Other than that, it works fine. Great service that I’m using too :) .
Ps. @Gaya:
Change the default Gravatar image.
-
oh right, the default image… think I’ll just unshow them =P
-
Akismet is working so far for me. I do not know why would you need to create a “number” in wordpress.com.


Recent comments