|
发表于 2004-7-13 16:46:59
|
显示全部楼层
来自 中国–广东–深圳
向导都搞不定??呵呵。。
给金老弟个程序,这是动网论坛翻译IP的来源的asp,有这么一段:
Function lookaddress(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 = "data/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 & "<br>" &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
End Function
不过其中用了SQL 语句,估计在amx里无法调用。。但希望对你有帮助。
adb = "data/ipaddress.mdb"这个是动网的IP库,和QQIP库应该是一样的。
到处都可以找到,也可以随时更新。 |
|