anupamsaha Posted June 2, 2009 Share Posted June 2, 2009 Hello, My development team is working on a login form that suppose to have a "remember me" feature. I would like to know what are the best practices involved in implementing a persistent login / session cookie with a server-side session file with a longer lifetime. Thanks in advance for your suggestions. Link to comment https://forums.phpfreaks.com/topic/160591-solved-what-is-the-best-way-of-having-persistent-session-cookie-and-server-side-session/ Share on other sites More sharing options...
trq Posted June 2, 2009 Share Posted June 2, 2009 Sessions and cookies are two different (though interconnected) things. Sessions persist data whilst you are active on a webpage. Cookies are used to persist data between visits. Link to comment https://forums.phpfreaks.com/topic/160591-solved-what-is-the-best-way-of-having-persistent-session-cookie-and-server-side-session/#findComment-847598 Share on other sites More sharing options...
anupamsaha Posted June 2, 2009 Author Share Posted June 2, 2009 Sessions and cookies are two different (though interconnected) things. Sessions persist data whilst you are active on a webpage. Cookies are used to persist data between visits. I know that session and cookies are two different things. But, when it comes to session_start(), a file sess_{session_id} in the server and a corresposding cookie (with a name session_id) is generated in client's PC. So, I wanted to know about the best practices to enhance the session lifetime that would overcome the session garbage collection method. So, I wanted to know if I increase the session garbage collection time and session lifetime, what will be the effect on the server as we will have lots of session files generated in the server. I also studied that PHP can be compiled witth "mm" directive while a site deals with too many session files. Am I making sense? Link to comment https://forums.phpfreaks.com/topic/160591-solved-what-is-the-best-way-of-having-persistent-session-cookie-and-server-side-session/#findComment-847660 Share on other sites More sharing options...
anupamsaha Posted June 2, 2009 Author Share Posted June 2, 2009 Any suggestions? Link to comment https://forums.phpfreaks.com/topic/160591-solved-what-is-the-best-way-of-having-persistent-session-cookie-and-server-side-session/#findComment-847903 Share on other sites More sharing options...
PFMaBiSmAd Posted June 2, 2009 Share Posted June 2, 2009 A session is designed to last for one browser session, but yes, you can extend it and make it persist between browser sessions (the php.net session handling documentation indicates how), but the best way to create a "remember me" feature is to use a cookie to identify the visitor. Link to comment https://forums.phpfreaks.com/topic/160591-solved-what-is-the-best-way-of-having-persistent-session-cookie-and-server-side-session/#findComment-847953 Share on other sites More sharing options...
anupamsaha Posted June 2, 2009 Author Share Posted June 2, 2009 A session is designed to last for one browser session, but yes, you can extend it and make it persist between browser sessions (the php.net session handling documentation indicates how), but the best way to create a "remember me" feature is to use a cookie to identify the visitor. Thanks PFMaBiSmAd. Link to comment https://forums.phpfreaks.com/topic/160591-solved-what-is-the-best-way-of-having-persistent-session-cookie-and-server-side-session/#findComment-847955 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.