| 首页
» Web开发 » ASP
|
| 显示ip来源(动网)
|
发表于:2005-07-27
阅读:次
|
显示ip来源(动网) - IdeaGrace | Web开发 | ASP,IdeaGrace,web,开发,技术,交流,教程 - http://www.ideagrace.com/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>IP</title>
</head>
<body>
<%
'response.write lookaddress("210.51.168.22")
%>
</body>
</html>
<%
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 = "ip.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 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
%>
喜欢本文?那就在线订阅更多文章更新吧!
加入技术论坛讨论
访问IdeaGrace开发者博客
浏览更多java开源项目
IdeaGrace开发者Wiki
更好的浏览体验,
|
|
|
|
|
©2008 Idea Grace
|