主页
<?php include("banIP.php");?>
禁用单个ip如下:banIP.php
<?php
//禁用ip地址
$ip=$_SERVER["REMOTE_ADDR"];
$ban=file_get_contents("ban.dat");
if(stripos($ban,$ip))
{
die("Your IP Address is:$ip,you're forbiden to view this page!");
}
echo "Your IP Address is:$ip,hello!";
?>
ban.dat文件如下:
BEGIN:
119.184.251.245
127.0.0.1
192.168....
PHP代码屏蔽地区IP,不影响排名办法
<?php
function get_client_ip() {
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
$ip = getenv("HTTP_CLIENT_IP");
else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"),
"unknown"))
$ip = getenv("HTTP_X_FORWARDED_FOR");
else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE...