Answer by beiller for How to tell if a session is active?
There are multiple places you need to check to verify the session is active: 1- cookie exists and is not expired 2- underlying session storage mechanism (file system or database) has a record matching...
View ArticleAnswer by Beachhouse for How to tell if a session is active?
Here's a good drop in replacement that won't break stuff when you move to 5.4: if(!function_exists('session_status')){ function session_active(){ return defined('SID'); } }else{ function...
View ArticleAnswer by hakre for How to tell if a session is active?
I'm running into this as well, and a setting in $_SESSION is not an option for me. For PHP 5.3.8: If any session has been started with the request, define('SID') will return FALSE, as well as $_SESSION...
View ArticleAnswer by ken for How to tell if a session is active?
See edits to the original question; basically, PHP 5.4 and above now has a function called session_status() to solve this problem! "Expose session status via new function, session_status" (SVN Revision...
View ArticleAnswer by Marc B for How to tell if a session is active?
I worked around this by adding a couple wrapper functions around the various session creation/closing/destroying functions. Basically: function open_session() { session_start(); $_SESSION['is_open'] =...
View ArticleAnswer by bpeterson76 for How to tell if a session is active?
Ken, if the session is destroyed, the $_SESSION array should not be available...or at the very least, your values should be unset. So, in theory (untested) you should be able to check the array for a...
View ArticleAnswer by Robert for How to tell if a session is active?
The following code only dumps one session_id() for me, not two session_start(); echo session_id(); session_destroy(); echo session_id(); If you're having difficulties with this still you can try...
View ArticleHow to tell if a session is active?
Per request, there are a few different ways that you can tell whether or not a session has been started, such as: $isSessionActive = (session_id() != ""); Or: $isSessionActive = defined('SID');...
View Article