Home > php教程 > PHP源码 > 分享一个新增备案不关站的代码

分享一个新增备案不关站的代码

PHP中文网
Release: 2016-05-26 08:19:50
Original
1168 people have browsed it

php代码

<script language="javascript" type="text/javascript" src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script>  
<script language="javascript" type="text/javascript">  
var city = remote_ip_info[&#39;city&#39;];  
if(city == &#39;北京&#39; || city == &#39;成都&#39;  ){  
document.write("感谢来访,我们正在建设中,需要很长时间。请过些时候来访问");  
}else{  
}  
  
</script>
Copy after login
<?php /*  
+--------------------------------------------+  
+程序授权说明         +  
+作者:森林                                  +  
+--------------------------------------------+  
*/ //-------------------------函数封装------------------------------------   
function ipdy($ipaddr) { $oo0ooo=base64_decode(&#39;aHR0cDovL2lwLnRhb2Jhby5jb20vc2VydmljZS9nZXRJcEluZm8ucGhwP2lwPQ==&#39;); $ipInfoApi= $oo0ooo.$ipaddr;    $areaInfo= file_get_contents($ipInfoApi);    $areaInfo= json_decode($areaInfo); $ipjg=$areaInfo->data->country.$areaInfo->data->area.$areaInfo->data->region.$areaInfo->data->city.$areaInfo->data->isp; $ipjg=iconv(&#39;UTF-8&#39;,&#39;GBK&#39;,$ipjg); return $ipjg;   
} //----------------IP-----------   
function get_real_ip(){  $ip=false;  if(!empty($_SERVER["HTTP_CLIENT_IP"])){  $ip = $_SERVER["HTTP_CLIENT_IP"];    
}  if (!empty($_SERVER[&#39;HTTP_X_FORWARDED_FOR&#39;])) {  $ips = explode (", ", $_SERVER[&#39;HTTP_X_FORWARDED_FOR&#39;]);  if ($ip) { array_unshift($ips, $ip); $ip = FALSE; }  for ($i = 0; $i < count($ips); $i++) {  if (!eregi ("^(10│172.16│192.168).", $ips[$i])) {  $ip = $ips[$i];  break;    
}    
}    
}  return ($ip ? $ip : $_SERVER[&#39;REMOTE_ADDR&#39;]);    
}  //---------------------------------   
$ip=get_real_ip(); $ip_str=ipdy($ip)
Copy after login
<?php /*  
+--------------------------------------------+  
+程序授权说明:该版本为GBK版即网页为GBK编码   +  
+作者:森林                                  +  
   
*/ include("ip_config.php"); //------------------------------以下根据情况修改------------------------   
if(stristr($ip_str,&#39;北京&#39;)  || stristr($ip_str,&#39;广东&#39;)){ exit("感谢来访,我们正在建设中,需要很长时间。请过些时候来访问。");   
}
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template