Answer the question
In order to leave comments, you need to log in
What should be the correct authorization?
Will it be considered an error if I authorize a user by his id. For example, there is a form with fields for login and password, I compare them with those in the database and if they match, then I write to the session $_SESSION['auth']='1';
And then I check like this:
if ($_SESSION['auth'] == '1') {
echo 'Вход';
}
else {
echo 'Выход';
}
Answer the question
In order to leave comments, you need to log in
the main thing is not to store it in cookies, otherwise you can manually write auth=1 there and voila.
For example, you can save id and hash = password + salt, and then check, there are different options.
SESSIONS are stored on your side, so they are more or less secure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question