How to set up a login system?

I am trying to find out whether it is better to store my user data in a session cookie (for example, password, username, etc.) and update this cookie only when I change the MYSQL database from my PHP,

OR

Store the username and user ID in the session cookie and access the MYSQL database every time I need to get the user data.

Which one is the best method.? I have never set up a login system, so any advice would be greatly appreciated.

+3
source share
3 answers

cookie . cookie ( ) . , , "cookie".

, , . , . , (, ) , .

, - , , -, , .

+2
. PHP. .

, , ... , .

+1

cookie. memcached, .

+1

Source: https://habr.com/ru/post/1753011/


All Articles