<?php
header("Content-type: text/html; charset=utf-8");
 
$verification = '广州市'; //配置黑名单地区 格式[市名] 
 
$ip = $_SERVER['REMOTE_ADDR'];
 
$antecedents = $_SERVER['HTTP_REFERER'];
 
$result = file_get_contents("http://whois.pconline.com.cn/ipJson.jsp?ip=".$ip."&json=true");
$result = iconv("gb2312", "utf-8//IGNORE",$result);
 
$address = json_decode($result,true);
 
 
if($address['city'] == $verification && strpos($antecedents, 'baidu') === false && strpos($antecedents, 'google') === false){
 
die();//
}