Log in a login window to determine login (useful OH), understand if statement should be used

Source: Internet
Author: User
Tags log
Statement <%
N=0
Adminid=request ("Adminid")
Password=request ("password")

If adminid= "" then%>
<script language=vbscript>
MsgBox "ERROR: Please enter administrator username!" "
Location.href = "Javascript:history.back ()"
</script>
<%elseif password= "" then%>
<script language=vbscript>
MsgBox "Error: Please enter your password!" "
Location.href = "Javascript:history.back ()"
</script>
<%end if%>

<!--#include file= "connect.asp"-->
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%
Timeout value for ' session.timeout=10 ' Session object
' 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 admin where adminid= '" &adminID& "", Conn, 3,3%>
<% if Rs.bof or rs.eof then%>
<script language=vbscript>
MsgBox "ERROR: The username does not exist, please make sure you are an administrator!" "
Location.href = "Javascript:history.back ()"
</script>
<% ElseIf rs ("password") <>password then%>

<% If RS ("Landing times") >3 then%>
<script language=vbscript>
MsgBox error: Too many logons! The system will shut down! "
Location.href= "Javascript:window.close ()"
</script>
<% Else%>
<script language=vbscript>
MsgBox "<% =rs (" Login Times ")%> error: This password is incorrect, please make sure you are the administrator! "
Location.href = "Javascript:history.back ()"
</script>
<%
RS ("Landing times") =rs ("Landing times") +1
Rs.update
End If
Else
RS ("Landing times") =0
Rs.update
Session ("Logstatus") =1 ' Log login status
Response.Redirect "Admin.asp"
End If
Conn.close
Set rs=nothing
%>




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.