aug 01 2005

comment spam

i have been getting comment spam, some of you might have noticed the poker, pills and texas poker spam in the comments...

 the nerve! but i was a little prepared for it, even though i didn't have the time to do it when i noticed it on the w/end, but i did sort it out it this morning.

it's a 'manual' thing though, so i guess i should maybe investigate making it more dynamic? here is the code i insert at the top of my page and then add the ip's that i capture from the comments posted on the site. it's not full proof because they chop and change their ip addresses as easy i say 'piss off mo-fo's'...

<?php
// ban ip code
$banned_ip = array();
$banned_ip[] = '00.00.00.00'; // first IP
$banned_ip[] = '00.00.00.00'; // second IP
$banned_ip[] = '00.00.00.00'; // third IP, just add more if you need

foreach($banned_ip as $banned) {
    $ip = $_SERVER['REMOTE_ADDR'];
    if($ip == $banned) {
        echo "You have been banned! It's probably because you spammed the comments or crawled for questionable content, if you think a mistake has been made contact someone@somewhere.com";
        exit();
    }
}
?>
i've been thinking of changing the echo, to just redirect to somewhere, but i've got to find something extremely nasty... ie. a page that just produces insane amounts of popups? anyone got any ideas?

Posted by sarah | web

comments

coda | 2005-08-12 18:32:00
mmm, no, it's all done by bots behind the scenes: check out referer spam on wikipedia, and more info here which better explains it.
sarah | 2005-08-12 18:04:52
thanks for the banned list, have added it to my .htaccess file. have people actually arrived at your site using those keywords, or entered comments with those keywords?
sarah | 2005-08-12 17:59:13
mine is all coming from the p-o-k-e-r sector (like on digicam). anything with that word in it gets deleted from the database, plus i'm sending spammers to weird addresses like; www.googleityoumoron.com, the addresses that referred them to me (god, knows how i got there - shows up on my stats). on posts that are being spammed there's no comments, some comments and no-one is showing up in more than one post. there are about 5 different posts they're targeting. a search for pages linking to me shows absolutely nothing? it's quite a pain the arse...
coda | 2005-08-12 16:59:34
comment spam is so weird, check this out!
coda | 2005-08-12 13:19:39
I'm not entirely sure how referrer spam works, I haven't done any research, only how to stop it! I used to have my "latest referrers" up on my site, and spammers latched onto that page and began hitting it with fake referrals. I've since removed it but they continue to appear in my log files/referrer list even though their link doesn't appear anywhere on my site. It's ridiculously pointless because I'm now the only one viewing my referrals so they have absolutely nothing to gain from it. I have a gigantic list of banned domains and keywords that you might like, it's pipe (|) delimited.
sarah | 2005-08-12 12:30:51
damien, it seems like it must be referrer spam, because they're only 'posting' on specific entries, i'll delve a little deeper and see if there is some-one who might be sending the spam my way...
sarah | 2005-08-04 21:01:40
referrer spam... huh? it get spam linking to other websites to increase their pagerank and google listings, i'm not sure about referrer spam, let me check it out and get back to you.

warren, thanks for the time and effort to get me more informed and clued up in general. i'll check out the links. thanks again!
coda | 2005-08-04 13:31:37
do you get referrer spam too?
warrenski | 2005-08-03 15:43:20
What about Bayesian filtering (what most email clients use to filter out spam)? It's a crazy thing to get your head around, but quite effective, and will minimise your admin load.

See:
http://en.wikipedia.org/wiki/Bayesian_filtering
http://www-128.ibm.com/developerworks/web/library/wa-bayes1/
warrenski | 2005-08-03 11:11:34
LOL, nice one! Found this in Google, which may interest you:
http://www.sitepoint.com/print/stop-comment-spam
sarah | 2005-08-03 10:56:27
hmm, the honeypot might not be a bad idea, i would rather love to see them:
a) squirm like a bug being sprayed with doom
b) rot in hell
c) trip and fall on their faces
d) all of the above...
warrenski | 2005-08-03 09:46:53
You can simplify your code somewhat using PHP's in_array function:

bool in_array ( mixed needle, array haystack [, bool strict])

example:
if (is_array($banned_ip) && in_array($_SERVER['REMOTE_ADDR'], $banned_ip)) {
echo("get lost");
}

An idea:
Redirect them to a special page on your site allowing them to comment spam as much as they want, but have no effect on your site whatsoever (sort of like a honeypot).

add a comment

verification image, type it in the box