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

发布时间:2022-04-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了asp 根据IP地址自动判断转向分站的代码脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
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 "&amp;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.js-code.COM")
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 根据IP地址自动判断转向分站的代码全部内容,希望文章能够帮你解决asp 根据IP地址自动判断转向分站的代码所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:asp根据IP