当前位置: 移动技术网 > IT编程>开发语言>.net > 根据IP地址自动判断转向分站的代码

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

2018年10月09日  | 移动技术网IT编程  | 我要评论

大地飞歌串词,gnome,飞屋环游记 国语

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://code.rdxx.com")
        if instr(urlcity,"深圳")<>0 then response.redirect("https://moban.rdxx.com")
        if instr(urlcity,"上海")<>0 then response.redirect("https://font.rdxx.com")

由于ip库超过1m,所以上传不了,ip库网上很多。上面只是其中一种方法.

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网