www.gusucode.com > 仿51.com的php源码 1.1 > ip/index.php

    <?
include "ip.class.php";
$IPConver=new IP;
$downUrl="down/ip.rar";
$contactUrl="contact";
?> 
<!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=gb2312" />
<title>51pr.com 您身边的互联网专家</title>
<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)|(net\.cn)|(org\.cn)|(name)|(biz)|(tv)|(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;
			}
		}
	}
}
//-->
</SCRIPT>
<link href="share/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="./"><img src="images/logo.gif" alt="51pr.com 您身边的互联网专家" width="159" height="40" hspace="15" border="0" /></a></td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="100%" height="28" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="20"><a href="./"></a></td>
    <td class="white"><a href="/" class="white">Home</a> | <a href="/blog" class="white">Blog</a> | <a href="/tools" class="white">Tools</a> | <a href="/contact" class="white">Contact</a> </td>
  </tr>
</table>
<table width="100%" height="28" border="0" cellpadding="0" cellspacing="0">
<FORM METHOD=POST ACTION="?"  name="ipform" onsubmit="return checkIP();">
	<tr>
	  <td height="25" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="20">&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td width="20">&nbsp;</td>
        </tr>
      </table></td>
    </tr>
	<tr>
	  <td height="25" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="20">&nbsp;</td>
          <td><strong class="bigfont">IP地址归属地查询</strong></td>
          <td align="right"><a href="<?=$downUrl?>"><img src="images/ds.gif" alt="下载此程序" width="12" height="12" hspace="8" border="0" /></a><a href="<?=$contactUrl?>"><img src="images/cs.gif" alt="联络" width="12" height="12" border="0" align="absmiddle" /></a></td>
          <td width="20">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td colspan="2"><hr size="1" color="#CCCCCC" /></td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
	<tr>
	  <td height="25" align="center" class="greenfont bigfont clear">
	  <? echo "IP地址:".$IPConver->Get($ip)."<br />";
			echo "所在位置:".$IPConver->Convert($ip);
			?></td>
    </tr>
	<tr>
		<td align="center" class="superclear">
		    在下面输入框中输入您要查询的IP地址或者域名,点击查询按钮即可查询该IP所属的区域。
			  <br />
		  IP地址或者域名:
        <input type="text" name="ip" size="16"> 
            <input type="submit" class="bt" value=" 查询 ">
            <INPUT TYPE="hidden" name="action" value="2">	  </td>
	</tr>
	<tr>
	  <td height="100" align="center" valign="bottom"><table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="center"><a href="<?=$downUrl?>"><img src="images/down.jpg" width="36" height="36" border="0" align="absmiddle" />下载此程序</a></td>
          <td align="center"><a href="<?=$contactUrl?>"><img src="images/contact.jpg" width="36" height="36" border="0" align="absmiddle" />联络我们</a></td>
          <td align="center"><a href="http://www.nicenic.com/vhost" target="_blank"><img src="images/vhost.jpg" width="36" height="36" border="0" align="absmiddle" />需要一个主机?</a></td>
        </tr>
      </table></td>
    </tr>
</FORM>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td width="20">&nbsp;</td>
    <td colspan="2"><hr size="1" color="#CCCCCC" /></td>
    <td width="20">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td height="35" colspan="2" align="center">版权所有 (C) 2004-2005<a href="http://www.nicenic.net" target="_blank"><strong> 耐思尼克(中国)</strong></a> 保留所有权利 </td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>