| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 772 人关注过本帖
标题:谁能帮我看看这段代码?
只看楼主 加入收藏
twinsvicki
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2005-9-13
收藏
 问题点数:0 回复次数:10 
谁能帮我看看这段代码?
<%'用户IP限制 function LockIP(sip) dim str1,str2,str3,str4 dim num LockIP=false if isnumeric(left(sip,2)) then str1=left(sip,instr(sip,".")-1) sip=mid(sip,instr(sip,".")+1) str2=left(sip,instr(sip,".")-1) sip=mid(sip,instr(sip,".")+1) str3=left(sip,instr(sip,".")-1) str4=mid(sip,instr(sip,".")+1) if isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 then else num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1 sql="select count(*) from 9j455noip where ip1 <="&num&" and ip2 >="&num&"" set rs_ip=conn.execute(sql) if rs_ip(0)>0 then LOCKIP=true end if set rs_ip=nothing end if end if end function%> <%if LockIP(Request.ServerVariables("REMOTE_ADDR")) then response.write "<script>alert('您的IP:"&request.servervariables("remote_addr")&"已经被限制不能访问,请和管理员联系');location.href='about:blank'</script><script>window.close();</script>" response.end end if %> <% noip=Request.Servervariables("HTTP_X_FORWARDED_FOR") If noip="" Then noip=Request.Servervariables("REMOTE_ADDR") set rst11=server.createobject("adodb.recordset") sql="select * from 9j455pkip where userip='"&noip&"'" rst11.open sql,conn,1,1 if not rst11.eof and not rst11.bof then response.write "<script>alert('您的IP:"&request.servervariables("remote_addr")&"已经被限制不能访问,请和管理员联系');location.href='about:blank'</script><script>window.close();</script>" response.end end if %> 在9j455noip表中明明是空的表,没有任何ip值的。为什么它还是能够弹出IP被限制,请和管理员联系的窗口。我试过好多次了。用本机127.0.0.1试的。
搜索更多相关主题的帖子: 代码 
2005-10-21 14:07
hxfly
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:5810
专家分:118
注 册:2005-4-7
收藏
得分:0 
以下是引用twinsvicki在2005-10-21 14:07:58的发言:
<%if LockIP(Request.ServerVariables("REMOTE_ADDR")) then response.write "<script>alert('您的IP:"&request.servervariables("remote_addr")&"已经被限制不能访问,请和管理员联系');location.href='about:blank'</script><script>window.close();</script>" response.end end if %>
把这个删除

2005-10-21 14:42
twinsvicki
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2005-9-13
收藏
得分:0 
删除也一样会弹出警告窗口啊?

2005-10-21 14:48
hxfly
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:5810
专家分:118
注 册:2005-4-7
收藏
得分:0 
上面我说要删除的代码应该是测试代码
把那个删除以后再把这个改一下
该成下面的

if not( rst11.eof and rst11.bof) then
    response.write "&lt;script&gt;alert('您的IP:"&amp;request.servervariables("remote_addr")&amp;"已经被限制不能访问,请和管理员联系');location.href='about:blank'&lt;/script&gt;&lt;script&gt;window.close();&lt;/script&gt;"
    response.end
    end if
%&gt;


这样呢?

2005-10-21 14:50
twinsvicki
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2005-9-13
收藏
得分:0 
把整个复制下来吧,我不知道你要改哪里?

2005-10-21 14:53
hxfly
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:5810
专家分:118
注 册:2005-4-7
收藏
得分:0 
<%'用户IP限制 function LockIP(sip) dim str1,str2,str3,str4 dim num LockIP=false if isnumeric(left(sip,2)) then str1=left(sip,instr(sip,".")-1) sip=mid(sip,instr(sip,".")+1) str2=left(sip,instr(sip,".")-1) sip=mid(sip,instr(sip,".")+1) str3=left(sip,instr(sip,".")-1) str4=mid(sip,instr(sip,".")+1) if isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 then else num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1 sql="select count(*) from 9j455noip where ip1 <="&num&" and ip2 >="&num&"" set rs_ip=conn.execute(sql) if rs_ip(0)>0 then LOCKIP=true end if set rs_ip=nothing end if end if end function%> <% noip=Request.Servervariables("HTTP_X_FORWARDED_FOR") If noip="" Then noip=Request.Servervariables("REMOTE_ADDR") set rst11=server.createobject("adodb.recordset") sql="select * from 9j455pkip where userip='"&noip&"'" rst11.open sql,conn,1,1 if not( rst11.eof and rst11.bof) then response.write "<script>alert('您的IP:"&request.servervariables("remote_addr")&"已经被限制不能访问,请和管理员联系');location.href='about:blank'</script><script>window.close();</script>" response.end end if %>
这样看看

2005-10-21 14:54
twinsvicki
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2005-9-13
收藏
得分:0 
还是不行啊!

2005-10-21 14:56
twinsvicki
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2005-9-13
收藏
得分:0 
用在别的站点就行,用到我这个站点就不行了。库我都是复制过来的,就是搞不明白是怎么回事。

2005-10-21 14:58
twinsvicki
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2005-9-13
收藏
得分:0 
搞定了,哈哈哈!

2005-10-21 17:05
jnzsk
Rank: 1
等 级:新手上路
威 望:1
帖 子:403
专家分:0
注 册:2004-11-13
收藏
得分:0 
怎么改呀?

2005-10-21 17:06
快速回复:谁能帮我看看这段代码?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013681 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved