Answer the question
In order to leave comments, you need to log in
Authorization in PHP?
I study php and I wonder how someone writes authorization give advice. Authorization through sessions.
Storing users in the database.
How do they make sure that the user does not log out when, after closing the browser, the page is opened again?
They also do something with tokens, make a separate plate and write the user and the token there, but why?
Everywhere only casual references.
How to make the most complete and correct authorization in pure PHP?
Please provide a link to the description if possible.
Answer the question
In order to leave comments, you need to log in
If I were you, I would start by understanding the Internet and learning how to search for information in it.
trite: the title of your question and the search on this resource.
And only then to study programming, etc.
Example.
1) Authorization form. The person entered a username and password.
2) If they are correct, a random key is generated. This key is stored in 2 places: in cookies and in the database.
3) Each time the page is loaded, the backend checks for the presence of this key in the cookie, and if it is, it checks against the one in the database. If the users and keys match, then the user is logged in. If not, then go to 1).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question