回 帖 发 新 帖 刷新版面

主题:大家进来帮帮忙,在线等。

现在正在做一个网站,要实现根据访问者的IP,让页面自动跳转到他所在城市的页面。
现在急需一个IP地址比较全的数据库,那位有的话发一个给我啊,小弟在此也谢谢了。
qq:694389067

回复列表 (共5个回复)

沙发

下个动网的

板凳

下了,但动网里面的IP是个整数,那我要怎样转换自己IP去和他比较啊

3 楼

有个转换程序
正好刚做过 粘给你了
<%
Set Connip = Server.CreateObject("ADODB.Connection")
ConnipStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & server.mappath("inc/IPaddress.mdb")
Connip.Open ConnipStr
''''GET ip
function Ip_Address(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 
      sql="select * from address where ip1 <="&num&" and ip2 >="&num 
      Set rsip=Connip.Execute(sql) 
      If rsip.eof And rs.bof Then 
         Ip_Address="没有数据" 
      Else 
         Do While Not rsip.eof 
           Ip_Address=Ip_Address &rsip("country") & rsip("city") 
           rsip.movenext 
         Loop 
      End If 
   End If 
Else 
   Ip_Address="无效IP" 
End If 
rsip.close 
Set rsip=nothing 
Connip.close
Set Connip=Nothing 
End Function 
%>

4 楼

谢谢,谢谢,

5 楼

罗嗦 
直接split(sip,".")不就行了

我来回复

您尚未登录,请登录后再回复。点此登录或注册