* ************************* Get the from Value
<% If request. servervariables ("request_method") = "Post" then
Set rs = server. Createobject ("ADODB. recordset ")
Username = trim (request. Form ("name "))
Psw = trim (request. Form ("password "))
* ************************* It cannot be null
If username = "" Or psw = "" then
Response. Write "<SCRIPT> alert ('user name and login password cannot be blank '); </SCRIPT>"
Response. Write "<SCRIPT> history. Go (-1); </SCRIPT>"
Response. End
End if
* *********************** Use session to limit the number of wrong inputs (3 times)
If SESSION ("Err")> = 3 then
Errorr = 1
Errmsg = "you have already tried so many times. If you are tired, please wait and try again, or contact the administrator! "
Else
SQL = "select * From webmaster where username = '" & username &"'"
Rs. Open SQL, CN, 3, 1
If Rs. EOF and Rs. bof then
Errorr = 1
Session ("Err") = SESSION ("Err") + 1
Errmsg = "the user name does not exist. Please return and enter it again! "
Rs. Close
Elseif psw <> RS ("password") then
Errorr = 1
Session ("Err") = SESSION ("Err") + 1
Errmsg = "the user name and password do not match. Please confirm and try again! "
Rs. Close
End if
End if
If errorr = 1 then
Response. Write "<SCRIPT> alert ('" & errmsg & "'); </SCRIPT>"
Response. Write "<SCRIPT> history. Go (-1); </SCRIPT>"
Rs. Close
Set rs = nothing
CN. Close
Response. End
End if
* *********************** Check that the session is successfully assigned and the page is redirected.
Response. Cookies ("username") = RS ("username ")
Response. Cookies ("userkey") = RS ("userkey ")
Rs. Close
Set rs = nothing
CN. Close
Session ("Err") = 0
Response. Write "<SCRIPT> location. href = 'mastermain. asp '; </SCRIPT>"
End if
%>