simply07 Posted June 26, 2008 Share Posted June 26, 2008 hello i am trying to keep users logged into my site once they close the browser. I was wondering if there was an easy way of converting cookie into sessions variables or vice versa. The thing is i am working on a large website and I was asked to keep users logged in once they close the browser. I know that session variables dies once the browser is closed so i was hoping to use cookies to store their info so when they reopen the browser they are still remembered Any help would be truly appreciated. Steph Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 26, 2008 Share Posted June 26, 2008 the best way i can think of is to generate a random hash (using md5 or such) every time the load a page (so it keeps rotating). store this value in a cookie and in your users table for your site. then, when they access the page again, check for that value and automatically log them in. fyi, this is a HUGE security risk, as cookies can be manually set by the user. as long as you keep it as a random hash, and keep changing it, it should be relatively reliable. obviously though, once the user is in, if they want to access sensitive info or change passwords, etc, you should make them enter their password Quote Link to comment 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.