Block IP's

Discussion corner for Developers of Serendipity.
Post Reply
Lowestman

Block IP's

Post by Lowestman »

I was wondering, how can I block IP address of a person making vulgar comments? I know that the IP is collected in the database.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Block IP's

Post by garvinhicking »

IP-Blocking should occur on a low level basis, preferrably via .htaccess

Does your server have mod_rewrite enabled?

Blocking certain IP addresses nowadays makes little sense because most Spammers and Hackers can change IP addresses at will, this is the reason why there is no setting for that in the spamblock plugin.

If you are running mdo_rewrite, add this in your .htaccess:

Code: Select all

DENY FROM 192.168.0.1
Another way would be to edit your serendipty_config_local.inc.php file and add this code at the end:

Code: Select all

if ($_SERVER['REMOTE_ADDR'] == '192.168.0.1') {
  die('Access denied');
}
(if you cannot edit the contents of your serendipty_config_local.inc.php file, you can insert this codepiece also in your index.php file at the top...)

Regards,
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/
Post Reply