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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-17 我要评论
想了解asp 根据IP地址自动判断转向分站的代码的相关内容吗,在本文为您仔细讲解根据IP地址自动判断的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点: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 "&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.qb5200.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一个回来

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们