请高手帮我解决一个问题!!!!!

l217219 2006-08-28 01:45:29
下面这段代码是把加到数据库的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("<script language=javascript>alert('对不起你没有权限访问此页面');history.back(1);</script>")
Response.End
End If
Set IpRS=Nothing
End Sub
%>
...全文
107 12 打赏 收藏 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
roseqiu1 2006-08-28
  • 打赏
  • 举报
回复
LZ 允许的哪几个ip段
l217219 2006-08-28
  • 打赏
  • 举报
回复
那位帮帮忙呀
l217219 2006-08-28
  • 打赏
  • 举报
回复
那们高手帮帮忙呀
l217219 2006-08-28
  • 打赏
  • 举报
回复
不得行
改了后一个IP也不能限制了
roseqiu1 2006-08-28
  • 打赏
  • 举报
回复
<%
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 (IpRS.bof AND IpRS.eof) Then
WhyIpLock=split(IpRS("iplock"),"|")
Response.Write("<script language=javascript>alert('对不起你没有权限访问此页面');history.back(1);</script>")
Response.End
End If
Set IpRS=Nothing
End Sub
%>
l217219 2006-08-28
  • 打赏
  • 举报
回复
我试了的不得行
去了那个是可以访问了
但不能限制了

我只允许几个IP段访问 ,
谁有好点的代码呀给一个给小弟呀
atmo 2006-08-28
  • 打赏
  • 举报
回复
If Not (IpRS.bof or IpRS.eof) Then
改成
if IpRs.bof and IpRs.eof then
flyingsnowy 2006-08-28
  • 打赏
  • 举报
回复
因为你打了那么多汉字。
penglewen 2006-08-28
  • 打赏
  • 举报
回复
怎么我总比LEO慢一步啊,哎......................
penglewen 2006-08-28
  • 打赏
  • 举报
回复
沙发,就是把If Not (IpRS.bof or IpRS.eof) Then 这句中的not 去丢就行了.............
<%
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 IpRS.bof or IpRS.eof Then
WhyIpLock=split(IpRS("iplock"),"|")
Response.Write("<script language=javascript>alert('对不起你没有权限访问此页面');history.back(1);</script>")
Response.End
End If
Set IpRS=Nothing
End Sub
%>
leohuang 2006-08-28
  • 打赏
  • 举报
回复
try
------------------------
If Not (IpRS.bof or IpRS.eof) Then
改成
If IpRS.bof or IpRS.eof Then

28,402

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧