主题:ip地址锁定问题?
ip地址锁定代码如下:
<% l_ip=request.servervariables("remote_addr")
theip=transip(l_ip)
hrdip=l_ip
'''''''''''''''''自动封锁功能开始
query="select * from iplck where (l_ipnum<=" & theip & " and l_ipendnum>=" & theip & ")"
rs.Open query,conn,1,1
if not rs.eof then '被锁
l_id=rs("l_id")
oldip=rs("l_ip")
hrdip=oldip
end if
rs.close
query="select * from iplck where (l_ipnum<=" & theip & " and l_ipendnum>=" & theip & ") and (l_sft=1 or l_hrd=1)"
rs.open query,conn,1,1
if rs.eof then
ckeerrs=clng(request.Cookies("hzhost")("loginerrs"))
if (ckeerrs>=clng(pl_ipsfttms)) or (cheerrs>=clng(pl_iphrdtms)) then
Response.Cookies("hzhost")("loginerrs") =0
Response.Cookies("hzhost").path = "/"
Response.Cookies("hzhost").expires =dateadd("yyyy",1,now())
'call errorpage(-2,"您当前已成功 解除了IP锁定,请返回重新登录!")
%>
<%
doresult=hardlock()
if doresult<>"" then
call errorpage(-2,"对不起,您连续登录失败次数过多,已被系统自动锁定!")
end if
''''如果达到软锁,则加入软锁结束
'''''''''''''''''自动封锁功能结束
rs.close
conn.close
call errorpage(-2,"对不起,您不是本站的合法用户,请返回(102)!")
elseif rs("u_lck")=1 then
call errorpage(-2,"对不起,该用户已被禁登录,请联系管理人员!")
elseif rs("u_sys")<4 then
call errorpage(-2,"对不起,用户权限不够,请联系管理人员!")
else
'''''''''''''''''自动封锁功能开始
'''''写coolies为0
Response.Cookies("hzhost")("loginerrs") =0
Response.Cookies("hzhost").path = "/"
Response.Cookies("hzhost").expires =dateadd("yyyy",1,now())
'''''写coolies为0结束
'''''''''''''''''自动封锁功能结束
query="select c_nme from clslst where c_cls="&rs("u_prc")
rs1.open query,conn,1,1
if rs1.recordcount<>1
'rs.recordcount 确定记录集中有多少记录
call errorpage(-2,"对不起,系统发生错误,请返回!")
else
levelname=trim(rs1("c_nme"))
pwid=rs("u_pwr")
rs("u_lgncnt")=clng(rs("u_lgncnt"))+1
rs("u_lsttme")=now()
rs("u_lstip")=request.servervariables("remote_addr")
rs.update
session("usrid")=rs("u_id")
session("usrname")=trim(rs("u_nme"))
session("usrpass")=yourpass
session("usrclass")=clng(rs("u_prc"))
session("sysclass")=rs("u_sys")
session("sysrotnme")=rs("u_rotnme")
session("sysare")=rs("u_are")
tempstr=split(session("sysare"),",")
tempstring=""
for tempc=0 to ubound(tempstr)
tempvar=trim(tempstr(tempc))
if chk_int(tempvar) then
if tempstring="" then
tempstring="u_myare="&tempvar
else
tempstring=tempstring &" or u_myare="&tempvar
end if
end if
next
if tempstring="" then
tempstring=" 1=1 "
end if
session("sysarestr")=tempstring
session("usrclassname")=levelname
session("usremail")=rs("u_eml")
rs.close
query="select pw_str,pw_nme from pwrlst where pw_id="&pwid
rs.open query,conn,1,1
if rs.recordcount=1 then
session("syspower")=trim(rs("pw_str"))
session("syspwrcls")=pwid
session("syspwrnme")=trim(rs("pw_nme"))
end if
rs.close
query="update lgnlst set l_ifok=1 where l_id="&logid
conn.execute query,1,1
conn.close
response.write "<script language='javascript'>"+vbcrlf
response.write "parent.location.href='/master/index.asp';"+vbcrlf
response.write "</script>"
'response.redirect "/control/"
response.end
end if
rs1.close
end if
End If
End If
%>
看不懂如何实现IP地址的锁定的,
高手指点一下,
<% l_ip=request.servervariables("remote_addr")
theip=transip(l_ip)
hrdip=l_ip
'''''''''''''''''自动封锁功能开始
query="select * from iplck where (l_ipnum<=" & theip & " and l_ipendnum>=" & theip & ")"
rs.Open query,conn,1,1
if not rs.eof then '被锁
l_id=rs("l_id")
oldip=rs("l_ip")
hrdip=oldip
end if
rs.close
query="select * from iplck where (l_ipnum<=" & theip & " and l_ipendnum>=" & theip & ") and (l_sft=1 or l_hrd=1)"
rs.open query,conn,1,1
if rs.eof then
ckeerrs=clng(request.Cookies("hzhost")("loginerrs"))
if (ckeerrs>=clng(pl_ipsfttms)) or (cheerrs>=clng(pl_iphrdtms)) then
Response.Cookies("hzhost")("loginerrs") =0
Response.Cookies("hzhost").path = "/"
Response.Cookies("hzhost").expires =dateadd("yyyy",1,now())
'call errorpage(-2,"您当前已成功 解除了IP锁定,请返回重新登录!")
%>
<%
doresult=hardlock()
if doresult<>"" then
call errorpage(-2,"对不起,您连续登录失败次数过多,已被系统自动锁定!")
end if
''''如果达到软锁,则加入软锁结束
'''''''''''''''''自动封锁功能结束
rs.close
conn.close
call errorpage(-2,"对不起,您不是本站的合法用户,请返回(102)!")
elseif rs("u_lck")=1 then
call errorpage(-2,"对不起,该用户已被禁登录,请联系管理人员!")
elseif rs("u_sys")<4 then
call errorpage(-2,"对不起,用户权限不够,请联系管理人员!")
else
'''''''''''''''''自动封锁功能开始
'''''写coolies为0
Response.Cookies("hzhost")("loginerrs") =0
Response.Cookies("hzhost").path = "/"
Response.Cookies("hzhost").expires =dateadd("yyyy",1,now())
'''''写coolies为0结束
'''''''''''''''''自动封锁功能结束
query="select c_nme from clslst where c_cls="&rs("u_prc")
rs1.open query,conn,1,1
if rs1.recordcount<>1
'rs.recordcount 确定记录集中有多少记录
call errorpage(-2,"对不起,系统发生错误,请返回!")
else
levelname=trim(rs1("c_nme"))
pwid=rs("u_pwr")
rs("u_lgncnt")=clng(rs("u_lgncnt"))+1
rs("u_lsttme")=now()
rs("u_lstip")=request.servervariables("remote_addr")
rs.update
session("usrid")=rs("u_id")
session("usrname")=trim(rs("u_nme"))
session("usrpass")=yourpass
session("usrclass")=clng(rs("u_prc"))
session("sysclass")=rs("u_sys")
session("sysrotnme")=rs("u_rotnme")
session("sysare")=rs("u_are")
tempstr=split(session("sysare"),",")
tempstring=""
for tempc=0 to ubound(tempstr)
tempvar=trim(tempstr(tempc))
if chk_int(tempvar) then
if tempstring="" then
tempstring="u_myare="&tempvar
else
tempstring=tempstring &" or u_myare="&tempvar
end if
end if
next
if tempstring="" then
tempstring=" 1=1 "
end if
session("sysarestr")=tempstring
session("usrclassname")=levelname
session("usremail")=rs("u_eml")
rs.close
query="select pw_str,pw_nme from pwrlst where pw_id="&pwid
rs.open query,conn,1,1
if rs.recordcount=1 then
session("syspower")=trim(rs("pw_str"))
session("syspwrcls")=pwid
session("syspwrnme")=trim(rs("pw_nme"))
end if
rs.close
query="update lgnlst set l_ifok=1 where l_id="&logid
conn.execute query,1,1
conn.close
response.write "<script language='javascript'>"+vbcrlf
response.write "parent.location.href='/master/index.asp';"+vbcrlf
response.write "</script>"
'response.redirect "/control/"
response.end
end if
rs1.close
end if
End If
End If
%>
看不懂如何实现IP地址的锁定的,
高手指点一下,

您所在位置: