Is it possible to check for a session with out starting one?
The reason that I ask is, the app I am developing has an integrated admin interface. So when an admin is logg
Here's a function that will do what you ask, which is checking whether a session exists before starting it:
function sessionExists() {
return (isset($_COOKIE[session_name()]));
}
If you want to test for it in the same request that you created it, you can do this instead:
function sessionExists() {
return (isset($_SESSION) || isset($_COOKIE[session_name()]));
}