Jump to content

cookies and session variables


simply07

Recommended Posts

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

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.