FoxyForest
08-21-2006, 05:35 PM
Hey,
I'm looking to add a feature to my login system where you can choose to have your login persist over time rather than ending when the browser closes. (A 'Remember me' option, basically). I understand that session.cookie_lifetime in php.ini is where I can set the expiry time for the session cookie. However, this is hardcoded, so how would I go about having a different expiry for each user? Some would need an expiry of zero, others would need a time value.
I can set the expiry time with session_set_cookie_params(), but the PHP manual says that this has to be called before session_start(), and it only persists for that script. So, do I just change the expiry time with that method at login time? Or do I have to do it before every session_start() and use some kind of flag cookie to tell the script what to set the expiry to? I'm getting rather confused. :confused:
I'm looking to add a feature to my login system where you can choose to have your login persist over time rather than ending when the browser closes. (A 'Remember me' option, basically). I understand that session.cookie_lifetime in php.ini is where I can set the expiry time for the session cookie. However, this is hardcoded, so how would I go about having a different expiry for each user? Some would need an expiry of zero, others would need a time value.
I can set the expiry time with session_set_cookie_params(), but the PHP manual says that this has to be called before session_start(), and it only persists for that script. So, do I just change the expiry time with that method at login time? Or do I have to do it before every session_start() and use some kind of flag cookie to tell the script what to set the expiry to? I'm getting rather confused. :confused: