Selling cookie info to third-parties is a classic example of you can make money without doing evil.
RSS

cgicomment-spam

2006/02/03 filed under /nanoblogger

Lately, my blog has been suffering from comment spam and taking it out isn't too user friendly (you have to do quite some deleting work).

So I had two options. Make deleting spam easier, or stop spammers. And yes, the second options seems easier and more preferable.

After glancing at the code of CGIComment, I realized it was fairly easy to stop. All of the spam-comments so far were casino related, so all I had to do was add a little snippet of code to the SaveComment sub.

 # Spam protection
 if($CommentInfo{'text'} =~ /(casino|poker)/i) { 
    print "<h1>Nuh uh ... can't use the word: $1</h1>";
    warn($ENV{'REMOTE_ADDR'}, " abused $0 with '$1'");
    return; 
 }

The first line is a comment, so let's look at the second one. It checks whether the $CommentInfo{'text'} (the comment users post) contains either the word "casino" or "poker" (case insensitive).

If that is the case, the user will see the banned word, a warning will be printed to the error log showing the users' IP address and banned word. And of course, the entry will not be saved.

Easy hack, although I fear the banned list to grow soon (I bet the word "blogspot" will follow soon ;-)

Posted by: B10m | permanent link | comments (0)
Comments are closed for this story.
Trackbacks are closed for this story.
return-member