I want my users to have secure session on my website. What must i store in cookie to recognise each user?
Every time user logs in, cookie value must be changed.
P.S. I want to make a database with cookie values which link to user id.
I want my users to have secure session on my website. What must i
Share
You should store a session ID in the cookie. That said, you should NOT have to do this yourself. Use PHP sessions, it does all the cookie handling for you.
Why do you need to store the session IDs in a database? If you need semi-temporary data to travel with the user during their session, you can use the
$_SESSIONvariable for that. It is documented as part of the guide above.PHP does not have native support for storing session IDs on the server in a database, you would have to write that yourself, or use a library that already provides that functionality, like CakePHP.