Member login detection code

Source: Internet
Author: User

* ************************* 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
%>

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.