Page 1 of 1

Redirecting known Spammers

Posted: Sun Sep 21, 2008 6:00 pm
by sonichouse
I am running cherokee web server which unfortunately does not support .htacess blocking of IP addresses.

If I know that the person visiting the blog is a serial spammer, is there a hack/plugin to redirect them to an empty page or return a 404 ?

I already use the spamblock RBL and Askimet to filter out comments, but I am trying to reduce the load on the web server.

TIA Steve

Re: Redirecting known Spammers

Posted: Sun Sep 21, 2008 7:15 pm
by garvinhicking
Hi!

You could hack your comment.php and perform the IP check at first instance inside this file, even before the s9y framework is loaded...

HTH,
Garvin

Re: Redirecting known Spammers

Posted: Sun Sep 21, 2008 7:24 pm
by sonichouse
garvinhicking wrote:Hi!

You could hack your comment.php and perform the IP check at first instance inside this file, even before the s9y framework is loaded...

HTH,
Garvin
Thanks, I was a bit more brutal, and put this in the head of my index.php

Code: Select all

$banned[0]="200.63.42.136"; // IP in the form of "127.0.0.1" or whatever
$banned[1]="200.63.42.136";
$banned[2]="200.63.42.136";// add as many as you wish
if (in_array($_SERVER['REMOTE_ADDR'],$banned)) {
    header("HTTP/1.1 403 Forbidden");
	exit();
}
Seems to work, and it also logs it to my web server error log.

This joker has submitted 50 comments in the last 48 hours.