婚纱相框:请问怎样通过asp查询纯真版IP数据库?

来源:百度文库 编辑:高校问答 时间:2024/05/05 10:47:52
php的有了,但是偶想找asp的,谢谢。列出最高效的检索方式。
嘿嘿,感谢朋友的关注。你给的这个是已经转化为mdb的了,你仔细看程序便知道。继续顶.

引用别人的,太多广告和集成多无法满足要求。

<%
Dim ip,ipaddress
ip=request("ip")
If ip="" Then
ip=request.ServerVariables("REMOTE_HOST")
ipaddress="你的IP:"&ip &"来自:"&getaddress(ip)
else
ipaddress=getaddress(ip)
End If
Function getaddress(sip)'查询函数
Dim str1,str2,str3,str4
Dim num
Dim irs
If isnumeric(left(sip,2)) Then
If sip="127.0.0.1" Then sip="192.168.0.1"
str1=left(sip,instr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str2=left(sip,instr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str3=left(sip,instr(sip,".")-1)
str4=mid(sip,instr(sip,".")+1)
If isNumeric(str1)=0 Or isNumeric(str2)=0 Or isNumeric(str3)=0 Or isNumeric(str4)=0 Then
Else
num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
Dim adb,aConnStr,AConn
adb = "QQWry.Dat"
aConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(adb)
Set AConn = Server.CreateObject("ADODB.Connection")
aConn.Open aConnStr
sql="select * from ip where StartIP <="&num&" and EndIP >="&num
Set irs=AConn.Execute(sql)
If irs.eof And irs.bof Then
getaddress="没有数据"
Else
Do While Not irs.eof
getaddress=getaddress &irs("pos") & irs("Detail")
irs.movenext
Loop
End If
irs.close
Set irs=nothing
Set AConn=Nothing
End If
Else
getaddress="无效IP"
End If
End Function
%><!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>IP地址查询</title>
<style type="text/css">
<!--
#f {
padding: 0px;
width: 500px;
margin-right: auto;
margin-left: auto;
}
#box {
padding: 0px;
width: 500px;
margin-right: auto;
margin-left: auto;
border: 1px solid #CCCCCC;
}
body,td,th {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</head>

<body>
<div id="f"><form name="form1" id="form1" method="get" action="">
IP地址:
<input name="ip" type="text" value="<%=request("ip")%>" />
<input type="submit" name="Submit" value="查询" />
</form></div>
<div id="box">
<%=replace(ipaddress,"CZ88.NET","")%>
</div>
</body>
</html>