How can I determine whether account logon verification is successful?

Source: Internet
Author: User
Most of the websites have user modules. How do I implement the login logic when the login function is required? The logic of personal implementation is: Find the user's password for the corresponding user verification based on the user name entered is the same as the password entered at login (after md5) Find the user and password verification... most of the websites have user modules. How do I implement the login logic when the login function is required?

The logic of personal implementation is:

  1. Find the corresponding user based on the entered User Name

  2. Verify that the user password found is the same as the password entered at login (after md5)

  3. Find the user and pass the password verification before saving it to the session

What I want to know is what the logic is when the great gods perform this function?
Then, will my current logic be faulty?

Reply content:

Most of the websites have user modules. How do I implement the login logic when the login function is required?

The logic of personal implementation is:

  1. Find the corresponding user based on the entered User Name

  2. Verify that the user password found is the same as the password entered at login (after md5)

  3. Find the user and pass the password verification before saving it to the session

What I want to know is what the logic is when the great gods perform this function?
Then, will my current logic be faulty?

In this way, each user login will request the database twice, which can be merged into one:
Check whether the current user name and md5 password record exist. If yes, the logon succeeds. Otherwise, the logon fails.

Based on the submitted user name, go to the database to query the information of the same user name. If not, the system prompts logon failure. If yes, the corresponding encrypted password matches the submitted password, if an error occurs, the logon fails. Otherwise, the logon succeeds! You only need to query it once! Then you store user information in the session.

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.