我现在有一段ASP写的IP查询代码:
<%
IP=request("ip")
if IP="" then
IP = Request.ServerVariables("REMOTE_ADDR") 
end if
Function cacuIp(ip)
On Error Resume Next
Dim srIp, aIp
srIp=0
aIp = Split(ip,".")
If UBound(aIP)<>3 Then
cacuIP=0
Exit Function
End If
For i=0 To 3
srIp=srIp+(CInt(aIP(i))*(256^(3-i)))
Next
cacuIp=srIp-1
If Err Then cacuIp=0
End Function 
Set CONN=Server.CreateObject("ADODB.Connection")
CONN.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.Mappath("ip.mdb")iIp=cacuIp(IP)
SQL = "SELECT country,city FROM 25175IP WHERE ip1<=" & iIp & " AND ip2>=" & iIp
Set rs = CONN.Execute ( SQL )
If rs.Eof Then
sPlace="查无记录"
Else
sPlace=rs(0)&" "&rs(1)
End If
Set rs=Nothing
Response.Write "<a href=""http://www.25175.com""> 你查询的IP所在地为:"&sPlace&" ("&ip&")</a>"
%>