Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Bad idea...
Never ever store the password in a cookie. Even if it's encrypted.
The encryption is to make harder the work of a hacker who did get in, not the 1st line of defense...
What I usually do is that I save a hash in the database for each users, and set the cookie with that same hash with a validity of a week, or so.
Then, each page view update the hash value both in db and in the cookie, and it update the cookie validity.
This way, the content is changing for each requests the user do.
Now, when a user which is not identified comes, look for the value of that hash in the cookie, and log in automatically if the content match 1 record.
That way, no username nor password are in the cookie, end the entropy on the checked field makes it a lot harder to overcome.
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 03-09-2008 at 05:35 PM..
|