Redirecting known Spammers

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Redirecting known Spammers

Post 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
Steve is occasionally blogging here
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Redirecting known Spammers

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Re: Redirecting known Spammers

Post 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.
Steve is occasionally blogging here
Post Reply