blocking an ip address

Soldato
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
Hi,

We have a problem member on our site that just keeps making new accounts but using the same IP address.

Is there anyway we can block that IP by editing a file on the server? and if so, which file and how?
 

Pho

Pho

Soldato
Joined
18 Oct 2002
Posts
9,324
Location
Derbyshire
I'd have thought most forums would have an IP address blocking section. Or if you have cPanel on your account try the 'IP Deny Manager' section (I've never used it, but it sounds promising).
 
Soldato
Joined
3 Jun 2005
Posts
3,065
Location
The South
As said, if it's a forum then you should have the option to ban based on IP. Likewise you have the option to block an IP on control panels like cPanel or Plesk.
Alternatively you can create a .htaccess file in the root and deny an ip access -
Code:
order allow,deny
deny from <ip_here>
allow from all
 
Associate
Joined
16 Jul 2008
Posts
271
Location
London
although .htaccess probably is a better method, another alternative is to use a line of server code, here is a php example:

PHP:
<?php
$banned[0]="127.0.0.1"; // Set IP Address
$banned[1]="127.0.0.2"; // adding another ip address
// can add as many as you want

if (in_array($_SERVER['REMOTE_ADDR'],$banned)) header("HTTP/1.1 403 Forbidden");
?>

Every page that you require restricted accesss will need to have this code added/included to it.
 

Pho

Pho

Soldato
Joined
18 Oct 2002
Posts
9,324
Location
Derbyshire
Alternately modify your chat script so that banned users can send messages but they never get delivered to anyone, let them waste their time ;).
 
Back
Top Bottom