jaymc Posted January 16, 2008 Share Posted January 16, 2008 Whats the best way to remember if a user is logged in I use sessions at the moment, but Ive had to set the session.cookie_lifetime to an obscene number to prevent the cookie from being deleted upon browser close I want to do it the proper way What is the standard? Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/ Share on other sites More sharing options...
Renlok Posted January 16, 2008 Share Posted January 16, 2008 http://php.net/setcookie Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/#findComment-441329 Share on other sites More sharing options...
revraz Posted January 16, 2008 Share Posted January 16, 2008 Session cookie isn't the same as a Cookie. As soon as you close the browser, the browser will pick up a new session if they come back. I am not sure what you gain by not clearing it except allowing people more time to try and hack the session id. Use a Cookie if you want to log them in upon return. Whats the best way to remember if a user is logged in I use sessions at the moment, but Ive had to set the session.cookie_lifetime to an obscene number to prevent the cookie from being deleted upon browser close I want to do it the proper way What is the standard? Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/#findComment-441332 Share on other sites More sharing options...
jaymc Posted January 16, 2008 Author Share Posted January 16, 2008 Just a standard setcookie? What should I store in a cookie to verify Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/#findComment-441347 Share on other sites More sharing options...
revraz Posted January 16, 2008 Share Posted January 16, 2008 What's a nonstandard cookie? Up to you what info you want to store. Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/#findComment-441352 Share on other sites More sharing options...
jaymc Posted January 16, 2008 Author Share Posted January 16, 2008 I could have a random hash in the members table and store that Then, if the cookie is set, and the data inside it = the hash, log them in Correcto? Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/#findComment-441353 Share on other sites More sharing options...
revraz Posted January 16, 2008 Share Posted January 16, 2008 Yep, totally up to you. You can search in regards to security concerns on what to store. Also depends on what your site actually does. For my admin screens, cookies or not, I make them log in again. Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/#findComment-441354 Share on other sites More sharing options...
jaymc Posted January 16, 2008 Author Share Posted January 16, 2008 Cool Thanks Quote Link to comment https://forums.phpfreaks.com/topic/86368-solved-remember-a-login/#findComment-441359 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.