Aljade Posted June 28, 2006 Share Posted June 28, 2006 I am making a user login system and I thought a way to make a session/cookie more secure I could store the users password encoded with sha1 and verify it.So for example when the user logged in I would make 2 sessions like so:[code]$_SESSION['user_id'] = $user_id;$_SESSION['secure_hash'] = $user_sha1_password;[/code]Also if the user selected to automatically login I created 2 cookies:[code]setcookie("autologin_userid", $user_id, time() + 31536000, "/Example", "example.com", 0);setcookie("autologin_secure", $user_sha1_password, time() + 31536000, "/Example", "example.com", 0);[/code]Then I would check the stored hashed password from cookies/sessions with the one that was stored in the database.Now is this actually making my system more secure than if I just stored the user's id in the session/cookie or is it making it less secure?Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/13145-storing-a-hashed-password-in-cookie/ Share on other sites More sharing options...
.josh Posted June 28, 2006 Share Posted June 28, 2006 i personally do something like this: take the user name and password and join them together in my own super secret alogorythm way. then encrypt that with md5 or sha1 and store that string as a cookie. Quote Link to comment https://forums.phpfreaks.com/topic/13145-storing-a-hashed-password-in-cookie/#findComment-50542 Share on other sites More sharing options...
mac.php Posted June 28, 2006 Share Posted June 28, 2006 Yeah that makes your system more secure in my humble opinion. Quote Link to comment https://forums.phpfreaks.com/topic/13145-storing-a-hashed-password-in-cookie/#findComment-50547 Share on other sites More sharing options...
Crusader Posted June 28, 2006 Share Posted June 28, 2006 I wouldn't suggest storing any passwords in a cookie. Why not just setup a session hash id that updated every page load? Quote Link to comment https://forums.phpfreaks.com/topic/13145-storing-a-hashed-password-in-cookie/#findComment-50577 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.