作家
登录

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

作者: 来源:www.28hudong.com 2013-03-30 08:24:04 阅读 我要评论

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://www.jb51.net") 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查询xml的代码 不刷新页面查询的方法

以下为引用的内容: <html> <head> <title>不刷新页面查询的方法</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <script language="javascript"> <!--初始化,将数据岛中>>>详细阅读


本文标题:asp 根据IP地址自动判断转向分站的代码

地址:http://www.17bianji.com/kaifa2/ASP/32095.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)