View Single Post
  #1   IP: 61.139.126.97
Old 2006-10-18, 12:49 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default How to block IPs

need to block one or more IPs from visiting your pages?
surfing the web, I was able to find this hint:
Quote:
$addr = array("1.2.3.4", "1.2.3.5", "1.2.3.6"); // array of IPs..
foreach($addr AS $key=>$value)
if (strstr($_SERVER['REMOTE_ADDR'], $value))
{
Header("Location:www.google.com");
}
you can insert this code just before the line starting with
error_reporting(0)
in the /index.php file.

I used it to block a static IP of a person I didn't want, and it works!
others could find it useful to permanently block spammers, ex-girlfriends, and so on
Reply With Quote