<%Function lookaddress(sip)
on error resume next
err.clear
Dim str1,str2,str3,str4,realip
Dim num
Dim irs
realip=sip
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 = "date/IPaddress.mdb"
aConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(adb)
Set AConn = Server.CreateObject("ADODB.Connection")
aConn.Open aConnStr
sql="select country,city from dv_address where ip1 <="&num&" and ip2 >="&num
Set irs=AConn.Execute(sql)
If irs.eof And irs.bof Then
lookaddress=template.Strings(12)
Else
Do While Not irs.eof
lookaddress=lookaddress & " " &irs(0) & irs(1)
irs.movenext
Loop
End If
irs.close
Set irs=nothing
Set AConn=Nothing
End If
Else
lookaddress=template.Strings(12)
End If
if err.number>0 then
lookaddress="地址不详 <a href='ip.asp?id="&realip&"' target=_blank>请点击咨询其他服务器</a>"
end if
End Function%>
照动网改的