I have a non CMS page in which a session value is stored using PHP's default session handler. ie:
session_start();
$_SESSION['MyVar'] = true;
On another page, which is part of the CMS, I need to test whether the variable is true or not. But, the CMS uses it's own session handler, so when I try to read the variable, it's undefined, because it's looking for it in the CMS's session storage system, not PHP's default.
How can I switch over for a moment and read a value from the default session store, and then reinstate the CMS's so that it functions correctly?
Something like:
$SessionHandler = session_get_current_handler(); // save the CMS session handler
session_use_default(); // Use PHP's default handler
$Value = $_SESSION['MyVar']; // Get the value I need
session_set_handler($SessionHandler); // Restore CMS handler