<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%HX_Conn 4:ColumnName="":Tablename="HX_IPAddress":myip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if myip = "" then myip = Request.ServerVariables("REMOTE_ADDR")%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网络IP查询</title>
<link rel=stylesheet type=text/css href="../HXinclude/HX_Style.css">
</head>
<body topmargin="20" leftmargin="0" bottommargin="0">
<table width="596"  border="0" cellspacing="1" cellpadding="0" align=center bgcolor="#613c25">
  <tr>
    <td colspan="2" bgcolor=FFFBE8><table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" background="../hximages/titleline.gif"><font class="fontmenu">网络IP查询</font></td>
  </tr>
</table><%
if request("search")="search" then
fip=request.form("ip")
c=fip
fip = Split(fip,".") 
if Ubound(fip)=3 then
For i=0 To Ubound(fip) 
if len(fip(i))=2 then
fip(i)="0"&fip(i)
elseif len(fip(i))=1 then
fip(i)="00"&fip(i)
end if
next
 oip=fip(0)&"."&fip(1)&"."&fip(2)&"."&fip(3)
 set rs1=WS_S.HX_SetRSD(ColumnName,Tablename," where  startip<='"&oip&"' and endip>='"&oip&"'and left(startip,3)='"&fip(0)&"' and  left(endip,3)='"&fip(0)&"' and  mid(startip,5,3)='"&fip(1)&"' and  '"&fip(1)&"'=mid(endip,5,3) and  mid(startip,9,3)='"&fip(2)&"' and  '"&fip(2)&"'=mid(endip,9,3)")
 if rs1.recordcount>0 then
 a=rs1("country")
 b=rs1("local")
 Call WS_S.HX_RSClose(rs1)
else
 set rs=WS_S.HX_SetRSD(ColumnName,Tablename," where startip<='"&oip&"' and endip>='"&oip&"'and left(startip,3)='"&fip(0)&"' and  left(endip,3)='"&fip(0)&"' and  mid(startip,5,3)='"&fip(1)&"' and  '"&fip(1)&"'=mid(endip,5,3)")
 if rs.recordcount>0 then
  a=rs("country")
  b=rs("local")
  Call WS_S.HX_RSClose(rs)
else
    set rs2=WS_S.HX_SetRSD(ColumnName,Tablename," where startip<='"&oip&"' and endip>='"&oip&"' and left(startip,3)='"&fip(0)&"' and  left(endip,3)='"&fip(0)&"'") 
     if rs2.recordcount>0 then
       a=rs2("country")
       b=rs2("local")
      Call WS_S.HX_RSClose(rs2)
else
 set rs3=WS_S.HX_SetRSD(ColumnName,Tablename," where startip<='"&oip&"' and endip>='"&oip&"'")
 if rs3.recordcount>0 then
 a=rs3("country")
 b=rs3("local")
Call WS_S.HX_RSClose(rs3)
else
a="找不到地址，如果你知道，请与本站联系，谢谢！"
end if
end if
end if 
end if 
  else
  a="错误:你输入的ip地址非法，请重新输入！"
  end if  

%>
<table border="0" cellpadding="4" style="border-collapse: collapse" width="100%" cellspacing="1" bgcolor=BF9B73>
    <tr>
      <td colspan="2" align="center" background="b1.gif" height="22" class=tdc1>搜索结果:</td>
    </tr>
    <tr bgcolor="#FFFBE8">
      <td width="38%" height="22" align="right">你要搜索的IP：</td>
      <td width="62%" height="22"><%=c%></td>
    </tr>
    <tr bgcolor="#FFFBE8">
      <td width="38%" height=22 align="right">所在地址：</td>
      <td width="62%" height=22><%=a%> <%=b%></td>
    </tr>
  </table><br><%
 end if
myip1 = Split(myip,".") 
if Ubound(myip1)=3 then
For i=0 To Ubound(myip1) 
if len(myip1(i))=2 then
myip1(i)="0"&myip1(i)
elseif len(myip1(i))=1 then
myip1(i)="00"&myip1(i)
end if
next
 myip2=myip1(0)&"."&myip1(1)&"."&myip1(2)&"."&myip1(3)
 set rs1=WS_S.HX_SetRSD(ColumnName,Tablename," where  startip<='"&myip2&"' and endip>='"&myip2&"'and left(startip,3)='"&myip1(0)&"' and  left(endip,3)='"&myip1(0)&"' and  mid(startip,5,3)='"&myip1(1)&"' and  '"&myip1(1)&"'=mid(endip,5,3) and  mid(startip,9,3)='"&myip1(2)&"' and  '"&myip1(2)&"'=mid(endip,9,3)")
 if rs1.recordcount>0 then
 a=rs1("country")
 b=rs1("local")
  set rs1=nothing
else
 set rs=WS_S.HX_SetRSD(ColumnName,Tablename," where startip<='"&myip2&"' and endip>='"&myip2&"'and left(startip,3)='"&myip1(0)&"' and  left(endip,3)='"&myip1(0)&"' and  mid(startip,5,3)='"&myip1(1)&"' and  '"&myip1(1)&"'=mid(endip,5,3)")
 if rs.recordcount>0 then
 a1=rs("country")
 b1=rs("local")
  set rs=nothing
else 
    set rs2=WS_S.HX_SetRSD(ColumnName,Tablename," where startip<='"&myip2&"' and endip>='"&myip2&"' and left(startip,3)='"&myip1(0)&"' and  left(endip,3)='"&myip1(0)&"'")
    if rs2.recordcount>0 then
 a1=rs2("country")
 b1=rs2("local")
set rs2=nothing
else
  set rs3=WS_S.HX_SetRSD(ColumnName,Tablename," where startip<='"&myip2&"' and endip>='"&myip2&"'")
    if rs3.recordcount>0 then
 a1=rs3("country")
 b1=rs3("local")
set rs3=nothing
else
a="找不到地址，如果你知道，请与本站联系，谢谢！"
end if
end if
  end if 
end if 
else
a1="抱歉，找不到地址！"
end if %>
<table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor=BF9B73>
   <tr>
    <td height="22" colspan="2" align="center">
      搜索某一 IP 地址的地理位置</td>
    </tr>
    <tr bgcolor="#FFFBE8">
      <td width="39%" align="right" height=22 class=tdc>请输入要搜索的IP地址：</td>
      <form method="post" action="">   
    <td width="61%" height=22 class=tdc>
    <input type="text" name="ip" size="30" style="ime-mode:disabled"> 
    <input type="hidden" name="search" size="20" value=search>
    <input type="submit" value="查 询" name="B1"></td></form>
    </tr>
       <tr bgcolor="#FFFBE8">
      <td width="39%" align="right" height=22 class=tdc> 你当前所在的IP：</td>      
    <td width="61%" height=22 class=tdc><%=myip%>  来自：<%=a1%> <%=b1%> </td></tr> 
</table></td>
  </tr>
</table>