判断IP
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
/**
* 获取用户真实 IP
*/
function getipCity($ip)
{
$url="http://ip.taobao.com/service/getIpInfo.php?ip=".$ip;
$ip=json_decode(file_get_contents($url));
if((string)$ip->code=='1'){
return false;
}
$data = (array)$ip->data;
return $data;
}
?>
<?php
///
$iipp=$_SERVER["REMOTE_ADDR"];
$b=getipCity("$iipp");
//print_r ($b);
$region_id=@$b[region_id];
//echo "$region_id";
if ($region_id ==410000) {
//echo "henan<br />";
//echo "$b[region]";
header("Location: http://www. .cn/");
} else {
header("Location: http://www. /");
}
exit();
?>