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

2025-05-27 0 68

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("//www.zzvips.com")

end if

if instr(UrlCity,"深圳")<>0 then

response.Redirect("http://img.zzvips.com")

end if

if instr(UrlCity,"上海")<>0 then

response.Redirect("http://xiazai.zzvips.com")

end if

所用到的IP数据库可以去网上down一个回来

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

快网idc优惠网 建站教程 asp 根据IP地址自动判断转向分站的代码 https://www.kuaiidc.com/69707.html

相关文章

发表评论
暂无评论