.
img
注册时间:--
  • 纯文字版本
    开 关闭
  • 消息
  • 收藏
  • 退出
注意:文章中$$符号只有一个,因程序问题提交后变成了两个。

根据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(“http://code.knowsky.com“)
if instr(UrlCity,“深圳“)<>0 then response.Redirect(“http://moban.knowsky.com“)
if instr(UrlCity,“上海“)<>0 then response.Redirect(“http://font.knowsky.com“)
由于IP库超过1M,所以上传不了,IP库网上很多,code.knowsky.com 就有下载。上面只是其中一种方法.
good 25

发表评论

文明评论,重在参与

暂无评论!
雷军主讲北京车展发布会!SU7 04-24
互联网汽车是什么?有什么优势呢 04-20
从“中国制造”走向“中国智造” 04-20
中国接入互联网30周年,马化腾 04-20
中国互联网30周年发展座谈会在 04-20
用著作权法来保护软件是否真的有 07-28
杀毒软件:只在搞娱乐,从未杀过 07-28
小谈高通反垄断 07-28
印度将推出百元智能机 山寨厂商 07-28
高通垄断之痛:不是国产手机大而 07-28
一张图读懂阿里巴巴眼花缭乱资本 07-28
滴滴打车副总裁张晶离职 高层换 07-28
返回ASP标签-返回首页
AD