关于网友提出的“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地址已被封锁"
- 封锁原因:"&WhyIpLock(1)
Response.Write" - 封锁时间:"&WhyIpLock(0)
Response.Write" - 请与管理员联系
Response.Write"
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
%>