|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
兴趣可能会慢慢消亡,所以适当培养兴趣会激发自己无线的乐趣,有了乐趣,编程有啥难的。这个内里的代码间接拷贝了OSC一名伴侣的,稍等上去贴地点。这会儿太慢,找不到了。。
- functionget_ip_data(){$ip=file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=".get_client_ip());$ip=json_decode($ip);if($ip->code){returnfalse;}$data=(array)$ip->data;if($data[region]==湖北省&&!isCrawler()){exit(http://www.lvtao.net);}}functionisCrawler(){$spiderSite=array("TencentTraveler","Baiduspider+","BaiduGame","Googlebot","msnbot","Sosospider+","Sogouwebspider","ia_archiver","Yahoo!Slurp","YoudaoBot","YahooSlurp","MSNBot","Java(Oftenspambot)","BaiDuSpider","Voila","Yandexbot","BSpider","twiceler","SogouSpider","SpeedySpider","GoogleAdSense","Heritrix","Python-urllib","Alexa(IAArchiver)","Ask","Exabot","Custo","OutfoxBot/YodaoBot","yacy","SurveyBot","legs","lwp-trivial","Nutch","StackRambler","Thewebarchive(IAArchiver)","Perltool","MJ12bot","Netcraft","MSIECrawler","WGettools","larbin","Fishsearch",);if(in_array(strtolower($_SERVER[HTTP_USER_AGENT]),$spiderSite)){returntrue;}else{returnfalse;}}//取客户端ipfunctionget_client_ip(){if(isset($_SERVER)){if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])){$realip=$_SERVER["HTTP_X_FORWARDED_FOR"];}elseif(isset($_SERVER["HTTP_CLIENT_IP"])){$realip=$_SERVER["HTTP_CLIENT_IP"];}else{$realip=$_SERVER["REMOTE_ADDR"];}}else{if(getenv("HTTP_X_FORWARDED_FOR")){$realip=getenv("HTTP_X_FORWARDED_FOR");}elseif(getenv("HTTP_CLIENT_IP")){$realip=getenv("HTTP_CLIENT_IP");}else{$realip=getenv("REMOTE_ADDR");}}return$realip;}
复制代码 不过还好,PHP语言给出的语法错误很详细,只要稍微熟悉一点之后,看错误提示就能很容易找出错误所在的。PHP还有一个特别好用的调试功能,在PHP语句中,你可以随时用echo来输出结果。 |
|