一个登陆窗口的记数判断登录(有用哦),了解IF语句的用应

80酷酷网    80kuku.com

  语句<%
n=0
adminID=Request("adminID")
password=Request("password")

if adminID="" then %>
<script language=vbscript>
MsgBox "错误:请输入管理员用户名!"
location.href = "javascript:history.back()"
</script>
<%elseif password="" then%>
<script language=vbscript>
MsgBox "错误:请输入你的密码!"
location.href = "javascript:history.back()"
</script>
<%end if%>

<!--#include file="connect.asp" -->
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%
'session.timeout=10'session对象的超时值
'on error resume next
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("examination.mdb")

Set rs = Server.CreateObject("ADODB.Recordset")
%>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%rs.Open "Select * From 管理 where adminID='"&adminID&"'", conn, 3,3%>
<% if rs.bof or rs.eof then%>
<script language=vbscript>
MsgBox "错误:该用户名不存在,请确认你是管理员!"
location.href = "javascript:history.back()"
</script>
<% elseif rs("password")<>password then%>

<% if rs("登陆次数")>3 then %>
<script language=vbscript>
MsgBox "错误:登录次数太多!系统将关闭!"
location.href="javascript:window.close()"
</script>
<% else %>
<script language=vbscript>
MsgBox "<% =rs("登陆次数")%>错误:该密码不正确,请确认你是管理员!"
location.href = "javascript:history.back()"
</script>
<%
rs("登陆次数")=rs("登陆次数")+1
rs.update
end if
else
rs("登陆次数")=0
rs.update
session("logstatus")=1 '记录登陆状态
response.redirect "admin.asp"
end if
conn.close
set rs=nothing
%>


分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: