Hello, can you set sessions to expire like you can cookies? If not, how long does a session you set on the server, last? Please let me know, thanks a lot. Jen
ini_set('session.gc_maxlifetime', time() + /* time in seconds */); ini_set('session.cookie_lifetime', time() + /* time in seconds */); PHP:
From php.net: http://www.php.net/session EDIT: I'd use 0 for the second, so that it expires on window close.
Most sessions expires after people close their browsers by default. I would set a end_date session variable and then check it each time a user get on the site. If the date > end_date. Then just session_destory the session. but the way sessions work is they set the SID cookie in the browser and you can then use the php cookie settings to set a end date on the SID cookie value for the session.
Good grief, wonder why they can't make it easy like cookies. Maybe someone will know how to help me with my session. How can I set a session expiration on this so that if they close their browser, reopen again, and go back to the same page, the same session will still be remembered? Your instructions sound like just using time() won't work. Please let me know, thank you very much. Jen session_start(); // check if session var is set // if not, set it to zero // else increase by one if(!isset($_SESSION['a'])) { $_SESSION['a'] = 0; }else{ $_SESSION['a']++; }