ip限制 将限制IP访问的代码改为允许访问的代码。谢谢

来源:互联网  时间:2016/7/11 8:45:23

关于网友提出的“ip限制 将限制IP访问的代码改为允许访问的代码。谢谢”问题疑问,本网通过在网上对“ip限制 将限制IP访问的代码改为允许访问的代码。谢谢”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题:ip限制 将限制IP访问的代码改为允许访问的代码。谢谢
描述:

<%
 Dim User_Ip
 User_Ip=Request.servervariables("REMOTE_ADDR")
 call IpLock(User_Ip)
 Sub IpLock(User_Ip)
 Dim IpArray,WhyIpLock
 IpArray=split(User_Ip,".")
 Dim IpSQL,IpRS
 IpSQL="SELECT iplock From IpLock Where  "& _
 " (ipsame=4 and ip1="&Cint(IpArray(0))&" and ip2="&Cint(IpArray(1))&" and ip3="&Cint(IpArray(2))&" and ip4="&Cint(IpArray(3))&" )  "& _
 " Or (ipsame=3 and  ip1="&Cint(IpArray(0))&"  and  ip2="&Cint(IpArray(1))&"  and  ip3="&Cint(IpArray(2))&" )   "& _
 " Or (ipsame=2 and ip1="&Cint(IpArray(0))&" and ip2="&Cint(IpArray(1))&" )   "& _
 " Or (ipsame=1 and ip1="&Cint(IpArray(0))&" ) Order By ipid "
 Set IpRS=Conn.execute(IpSQL)
 If Not (IpRS.bof or IpRS.eof) Then
 WhyIpLock=split(IpRS("iplock"),"|")
  Response.Write"

    你使用的IP段或IP地址已被封锁"
      Response.Write"
  1. 封锁原因:"&WhyIpLock(1)
      Response.Write"
  2. 封锁时间:"&WhyIpLock(0)
      Response.Write"
  3. 请与管理员联系
"
  Response.End
 End If
 Set IpRS=Nothing
 End Sub
%>
以上是限制IP访问的,在一个名为ipcode.asp的文件里
网站里是调用这个ipcode.asp的
现在想改成允许这些IP访问的,请问如何修改,谢谢 


解决方案1:

<%
 Dim User_Ip
 User_Ip=Request.servervariables("REMOTE_ADDR")
 call IpLock(User_Ip)
 Sub IpLock(User_Ip)
 Dim IpArray,WhyIpLock
 IpArray=split(User_Ip,".")
 Dim IpSQL,IpRS
 IpSQL="SELECT iplock From IpLock Where "& _
 " (ipsame=4 and ip1="&Cint(IpArray(0))&" and ip2="&Cint(IpArray(1))&" and ip3="&Cint(IpArray(2))&" and ip4="&Cint(IpArray(3))&" ) "& _
 " Or (ipsame=3 and ip1="&Cint(IpArray(0))&" and ip2="&Cint(IpArray(1))&" and ip3="&Cint(IpArray(2))&" ) "& _
 " Or (ipsame=2 and ip1="&Cint(IpArray(0))&" and ip2="&Cint(IpArray(1))&" ) "& _
 " Or (ipsame=1 and ip1="&Cint(IpArray(0))&" ) Order By ipid "
 Set IpRS=Conn.execute(IpSQL)
 If Not (IpRS.bof or IpRS.eof) Then
  Response.Write"
    你可以正常访问。。。"
      '页面跳转
      Response.End
     End If
     Set IpRS=Nothing
     End Sub
    %>

上一篇sql查询的问题
下一篇如何 GridView 动态生成列
明星图片
相关文章
《ip限制 将限制IP访问的代码改为允许访问的代码。谢谢》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)