Can’t find answer to my question.
I’m creating registration and need autologin for user with cookie.
What kind of information should be stored in cookie? Is it username + hash password or what
Can’t find answer to my question. I’m creating registration and need autologin for user
Share
First, just to echo what everyone else has said, this isn’t so much an auto-login feature as it is a ‘remember me if I navigate away from the page’ feature.
How I have seen it done in the past is similar to the implementation explained by frostymarvelous. Basically I have seen 3 cookies used:
Cookie 1:
Cookie 2:
Cookie 3:
Basically, cookie 3 is the most important cookie and I would include a couple things in this to prevent it from being duplicated easily:
The contents of ‘websitePassword.php’ should just be:
I would also suggest making the cookies expire after a timelimit to make your website more secure and you could possibly add a time element to your hash so if they try to use that particular hash after a particular amount of time, they will not be logged in automatically.