Search code examples
phpcookiessetcookie

What values should store in cookie?


I have a table and have two column for username and password. I want to store a cookie for remember user's login. So what field should i use? I'm getting confused about storing username in the cookie. Because someone can try to log via rewrite a fake cookie. What should i do?


Solution

  • You should never store their username and password in a cookie. For a good example on how to handle this, see: "Keep Me Logged In" - the best approach