网络编程 
首页 > 网络编程 > 浏览文章

asp 根据IP地址自动判断转向分站的代码

(编辑:jimmy 日期: 2024/9/22 浏览:3 次 )
Function getIpvalue(clientIP)'得到客户端的IP转换成长整型,返回值getIpvalue
On Error Resume Next
Dim strIp, array_Ip
strIp=0
array_Ip = Split(clientIP,".")
If UBound(array_Ip)<>3 Then
getIpvalue=0
Exit Function
End If
For i=0 To 3
strIp=strIp+(CInt(array_Ip(i))*(256^(3-i)))
Next
getIpvalue=strIp
If Err Then getIpvalue=0
End Function
clientIP=request.ServerVariables("REMOTE_HOST")
IpValue=getIpvalue(clientIP)
strSql="select top 1 City from [Ipaddress] where "&IpValue&"
between Ip1 and Ip2"
Set RsIp=conn.execute(strSql)
If RsIp.bof and RsIp.eof then
UrlCity="未知"
Else
UrlCity=RsIp.Fields.Item("City").Value
End If
if instr(UrlCity,"广州")<>0 then
response.Redirect("https://www.jb51.net")
end if
if instr(UrlCity,"深圳")<>0 then
response.Redirect("http://img.jb51.net")
end if
if instr(UrlCity,"上海")<>0 then
response.Redirect("http://xiazai.jb51.net")
end if
所用到的IP数据库可以去网上down一个回来
上一篇:asp dictionary对象的用法
下一篇:asp 多关键词搜索的简单实现方法
一句话新闻
Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 SiteMap