When thinking about security and user experience, what information id OK, acceptable, or even a good idea to store in a cookie?
EDIT:
With the understanding that sensitive info, like user names, passwords, SSN, credit card numbers don't belong there, what does?
A common practice is to just store a session ID in a cookie, and store all other relevant information in a database (or file, or whatever) on the server, indexed by session ID.
You can't trust any information stored in a cookie, as the user can manipulate it at his/her leisure. I suggest using a PHP session to store the object. That way, the end user only has a session ID stored in a cookie, with the real data on your server.
Cookies are small pieces of text sent to your browser by a website you visit. They help that website remember information about your visit, which can both make it easier to visit the site again and make the site more useful to you.
Definitely not passwords! Or anything sensitive... remember that cookies are stored on people's computers so from your point of view (as a website developer), they're basically out in the wild, potentially accessible to anyone.
A common practice is to just store a session ID in a cookie, and store all other relevant information in a database (or file, or whatever) on the server, indexed by session ID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With