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:
Find the corresponding user based on the entered User Name
Verify that the user password found is the same as the password entered at login (after md5)
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:
Find the corresponding user based on the entered User Name
Verify that the user password found is the same as the password entered at login (after md5)
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.