网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   代码交流 (https://www.0058.net/forumdisplay.php?f=16)
-   -   How to block IPs (https://www.0058.net/showthread.php?t=1600)

topvip 2006-10-18 12:49 AM

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


All times are GMT +8. The time now is 10:38 PM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.