Forum Moderators: coopster
I'm pretty proud of it, and really enjoying this programming.
Just one question. I am tracking the users with sessions, and when the user closes the browser, the session (and thus their login) ends as well. Any way of preventing this? Pointing me in the right direction would be helpful too. I've looked around and google'd the topic, that's how I found this place. :) Thanks!
You can set the cookie lifetime using session_set_cookie_params() [php.net]
Also, you might want to consider just normal cookies through set_cookie() [php.net]
You can also set the cookie lifetime in .htaccess using an entry like..
<IfModule mod_php4.c>
php_value session.cookie_lifetime 180
</IfModule>
The trouble I found with this approach is that it causes 'real' cookies to be used (instead of session cookies).
A different approach would be to record the last access time as a session variable. That way you can check it to see if if the session has timed out.