Weeding Out Spam Comments
Posted in Tech
Forenoon watch, 4 bells (10:10 am)

Until someone writes a copy of what my friend Mike wrote (ReverseDOS) that I can use with WordPress in a Linux environment, I'll keep experimenting with anti-spam comment measures. My latest idea comes from perusing my logfiles and noticing that most spam comments are posted directly to the comments page and aren't being http-referred there from another page on my site. A simple code addition to the comments page (wp_comments_post.php, line 49 or so) should fix that:

if(!ereg("bogomip.net", $_SERVER['HTTP_REFERER'])) {
die(__('Error: Spam comments are not allowed here.'));

Obviously, you could substitue your own server name for mine. Or not, if you don't want any comments. You could also be more restrictive: ereg for "^http://bogomip.net/blog/" … I prefer not to, because my site is sometimes reached by www.bogomip.net. I suppose I could do ereg("^http://(www\.)?bogomip.net/", $_SERVER['HTTP_REFERER']), but come on, what's the point?

1 Comment »

One Response to “Weeding Out Spam Comments”

  1. Glen says:

    Why be white hat? Be black hat. Have an auto-email to the spam address asking them to not post spam. Of course dont use a valid originating email address.

Leave a Reply