首頁  >  文章  >  php教程  >  php精简高速ip查询免费版3.0

php精简高速ip查询免费版3.0

PHP中文网
PHP中文网原創
2016-05-25 17:11:251552瀏覽

php精简高速ip查询免费版3.0 

1.IP地址查询php版,采用淘宝IP地址库,非常的精准。并且会随着淘宝IP地址库实时更新。所以您获得的数据将会是最新的。 
2.此3.0核心函数代码加密 其它2.0 1.0 版本完全开源 
3.define('SINA_SAE', '0'); //是否启用新浪SAE平台1为使用0为不使用 如使用新浪SAE平台必须开启memcache 
4.define('REWRITE', '0'); //是否启用伪静态 
5.集成WhoIs信息查询接口 

.htaccess 通用伪静态规则 其它规则请参考下面的进行修改 
RewriteEngine on 
RewriteRule ^(.*)$ index.php?id=$1 [L] 

sina SAE专版伪静态规则 
- rewrite: if (!is_dir() && !is_file() && path ~ "/(.*)" ) goto "index.php?$1" 

文件说明 
index.php      主程序 
function.php   主函数 

其它文件 
readme.txt     说明文件 
cacheip.txt    数据缓存文件 
bg_body.jpg    背景图 

[PHP]代码   

<?php ob_start(&#39;ob_gzip&#39;);   //gzip压缩
define(&#39;SINA_SAE&#39;, &#39;0&#39;); //是否启用新浪SAE平台1为使用0为不使用
define(&#39;REWRITE&#39;, &#39;0&#39;); //是否启用伪静态 1为启用0为不启用
$weburl=getenv(&#39;SERVER_NAME&#39;);
require_once(&#39;function.php&#39;);
$weblink=REWRITE?"http://".$weburl."/":"http://".$weburl."/?";if(count($_GET)>0){$urlip=array_keys($_GET);$urlip=str_replace("/","",str_replace("_",".",$urlip[0]));}
$ipname=$ip=$_POST[&#39;ip&#39;]?$_POST[&#39;ip&#39;]:$urlip;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<TITLE><?php if($ip){echo $urlip.",";}?>IP地址查询,淘宝ip,新浪ip,电脑IP地址查询,网站IP地址查询,精确IP地址查询-<?=$weburl;?></TITLE>
<META NAME="Generator" CONTENT="ip,代理IP查询,IP地址查询">
<META NAME="Author" CONTENT="IP查询,tbip.sinaapp.com">
<META NAME="Keywords" CONTENT="电脑IP地址查询,淘宝ip,新浪ip,网站IP地址查询,IP地址查询,代理IP查询,域名ip地址,域名whois,<?=$weburl;?>">
<META NAME="Description" CONTENT="电脑IP地址查询主要能够查询本地电脑的ip,网站IP地址,域名ip地址,ip所在省区,域名whois信息,代理IP查询并提供IP地址查询php源码下载尽在<?=$weburl;?>">
<style type="text/css">body {font-size:14px;line-height:150%;background-image: url(<?=$weblink?>bg_body.jpg);background-repeat:repeat-x;}
a{ text-decoration:none; color:#990000}.detect_table {border: 1px solid #C3E1EE;border-collapse: collapse;margin-top: 5px;width: 650px;}</style>
<SCRIPT LANGUAGE="JavaScript">function checkIP(){var ipArray,ip,j;ip = document.ipform.ip.value;if(/[A-Za-z_-]/.test(ip)){if(!/^([\w-]+\.)+((com)|(net)|(org)|(gov\.cn)|(info)|(cc)|(com\.cn)|(com\.hk)|(net\.cn)|(org\.cn)|(com\.ru)|(net\.ru)|(org\.ru)|(name)|(biz)|(hk)|(vn)|(com\.sg)|(pk)|(ph)|(ac)|(bz)|(de)|(net\.au)|(my)|(tv)|(us)|(jp)|(kr)|(sg)|(mn)|(cd)|(ue)|(sh)|(lc)|(hn)|(me)|(la)|(cc)|(tk)|(com\.tw)|(cm)|(cn))$/.test(ip)){alert("不是正确的域名,请检查域名格式或看是否有空格");	document.ipform.ip.focus();return false;}}else{ipArray = ip.split(".");j = ipArray.length;if(j!=4){alert("不是正确的IP");document.ipform.ip.focus();return false;}for(var i=0;i<4;i++){if(ipArray[i].length==0 || ipArray[i]>255){alert("不是正确的IP");document.ipform.ip.focus();return false;}}}}google_ad_client = "ca-pub-2006512290696014";google_ad_slot = "6662313368";google_ad_width = 468;google_ad_height = 60;
</script></head><body>
<?php
if(!$ip)$ip=get_real_ip();
$ip=preg_match(&#39;/((\w|-)+\.)+[a-z]{2,4}/i&#39;,$ip)?gethostbyname($ip):$ip;$ipdata=ipdata($ip,&#39;all&#39;);?>
<p align="center" style="margin-top:100px">
<p> </p><p><a href="http://ref.so/pv18" title="<?=$weburl;?>IP查询介绍" target="_blank">IP查询</a></p>
</p>
<p class="c" align="center">
<p>
<FORM METHOD=POST ACTION="" name="ipform" onsubmit="return checkIP();">
<p>IP地址或域名:
<input type="text" name="ip" size="27" maxlength="100" title="<?=$weburl;?>提醒您在此输入ip或域名" id="url" value="<?=$ipname?>"> 
<input type="submit" value="查 询" id="sub"><INPUT TYPE="hidden" name="action" value="2"></p>
</FORM>
<p><?php
if(is_ip($ip)){
	$ipaddress=$ipdata->country;
	if($ipdata->region==$ipdata->city){$ipaddress.=$ipdata->city;}else{$ipaddress.=$ipdata->region.$ipdata->city;}
	$ipaddress.=$ipdata->isp;
	echo "您查询的IP: [<a href=&#39;".$weblink.$ip."&#39;><font color=#FF0000>".$ip."</font></a>]IP详细地址: [<font color=#FF0000>".$ipaddress."</font>]<br/>"; 
}else{echo "囧,你输入的IP,居然不能查询到!不是输入错误?";}
$ipdaili=$_SERVER[&#39;REMOTE_ADDR&#39;];
if(!in_array($ipdaili,array(&#39;127.0.0.1&#39;,$ip,$_SERVER[&#39;SERVER_ADDR&#39;],get_real_ip()))){
	echo "您的代理IP是[<a href=&#39;".$weblink.$ipdaili."&#39;><font color=#FF0000>".$ipdaili."</font></a>]     来自".ipdata($ipdaili)."";
}
$whiosip=$_POST[&#39;ip&#39;]?$_POST[&#39;ip&#39;]:$urlip;
if($whiosip){preg_match(&#39;/((\w|-)+\.)+[a-z]{2,4}/i&#39;,$whiosip) ? $whois=str_replace("www.","",$whiosip):"";}
if($whois){echo "<br /><br /><a href=&#39;http://2.tbip.sinaapp.com/whois.php?d=".$whois."&#39; target=&#39;_blank&#39; title=&#39;数据来源于本站WhoIs信息查询接口&#39;>".$whois." WhoIs信息</a> <a href=&#39;http://www.ddung.org/tool/icp/index.php?k=".$whois."&#39; target=&#39;_blank&#39; title=&#39;数据来源于迷糊工具网 www.ddung.org备案信息查询接口&#39;>".$whois." 备案信息</a> <a href=&#39;http://72e.hbwanghai.com/domain/who_single.aspx?DomainName=".$whois."&#39; title=&#39;数据来源于联动天下72e.hbwanghai.com WhoIs信息查询接口&#39; target=&#39;_blank&#39;>".$whois." WhoIs信息</a>";}$sinaip=sinaip($ip);if($whois){cacheip($whiosip);}else{cacheip($ip);}
?></p></p></p>
<p align="center" style="margin-top:50px">
<table class="detect_table" id="ip_all">
<tbody><tr><th>IP</th><th>国家/地区</th><th>省份</th><th>城市</th><th>运营商</th><th>来源</th></tr>
<tr><td align="center"><span class="sip"><?=$ip;?></span></td><td align="center"><?=$ipdata->country.$ipdata->area?></td><td align="center"><?=$ipdata->region?></td><td align="center"><?=$ipdata->city?></td><td align="center"><?=$ipdata->isp?></td><td align="center">淘宝</td></tr>
<tr><td align="center"><span class="sip"><?=$ip;?></span></td><td align="center"><?=$sinaip[3]?></td><td align="center"><?=$sinaip[4]?></td><td align="center"><?=$sinaip[5]?></td><td align="center"><?=$sinaip[9]?><?=$sinaip[7]?></td><td align="center">新浪</td></tr>
  <tr><td align="center"><span class="sip">其它结果</span></td><td align="center"><a href="http://2.tbip.sinaapp.com/?ip=<?=$ip?>&type=qq" target="_blank">腾讯搜索结果</a></td><td align="center"><a href="http://2.tbip.sinaapp.com/?ip=<?=$ip?>&type=chunzhen" target="_blank">纯真搜索结果</a></td><td align="center"><a href="http://2.tbip.sinaapp.com/?ip=<?=$ip?>&type=pconline" target="_blank">太平洋搜索结果</a></td><td align="center"><a href="http://2.tbip.sinaapp.com/?ip=<?=$ip?>&type=google" target="_blank">谷歌搜索结果</a></td><td align="center"><a href="http://2.tbip.sinaapp.com/?ip=<?=$ip?>&type=youdao" target="_blank">有道搜索结果</a></td></tr>
</tbody></table><br><table class="detect_table" id="ip_all">
<tbody><tr>
<?php foreach(cacheip() as $k => $v){
if($k==6)echo "</tr><tr>";
echo &#39;<td align="center"><a href="&#39;.$weblink.$v.&#39;">&#39;.$v.&#39;</a></td>&#39;;}?></tr>
</tbody></table><br>
<?=base64_decode("PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiIHNyYz0iaHR0cDovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9zaG93X2Fkcy5qcyI+PC9zY3JpcHQ+");?>
  <p>Copyright &copy; <a href="http://72e.hbwanghai.com" target="_blank">联动天下</a> <a href="http://www.ddung.org/tool/icp/" target="_blank">域名备案查询</a> <a href="http://taokehui.sinaapp.com" target="_blank">健康减肥</a> All Rights Reserved <a href="<?=$weblink;?>"><?=$weburl;?></a> <a href="http://www.ctdisk.com/u/349707/437278" target="_blank">源码下载</a></p><p>本站为非赢利站点,如有好的建议和意见请发email:web@hbwanghai.com.给我们留言谢谢!
<br>
如果您觉得本站对您的朋友有帮助,别忘了告诉他(她)们哟 ^_^<br>点击广告赞助本站开发!</p><p class="bdlikebutton"></p>
<script id="bdlike_shell"></script>
<script>var bdShare_config = {"type":"large","color":"blue","uid":"533431","share":"yes"};
document.getElementById("bdlike_shell").src="http://bdimg.share.baidu.com/static/js/like_shell.js?t=" + new Date().getHours();
</script></p><p style="display:none"><script language="javascript" type="text/javascript" src="http://js.users.51.la/3729735.js"></script></p></body>
</html><?php ob_end_flush(); ?>

  

 QQ截图20120602103554.png                     

php精简高速ip查询免费版3.0

                                           

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn