I have a page that hosts one or more iframes, all from same domain.
for the main page and for each iframe I have a different session name (session_name()) so I can keep track of them. I know the name of each session.
If I am in one session - how can I modify one of the other sessions?
I tried (the overkill) this:
$session = session_name();
session_write_close();
unset($_SESSION);
session_name("othersession"); //a session that was initialized via the iframe
session_start();
$_SESSION['test'] = "hello from other session";
session_write_close();
unset($_SESSION);
session_name($session);
session_start();
yet, when I look at the original session - the "hello.." message is there as well. Infact, its ONLY there and not in the othersession session..
What am I doing wrong? Thanks!
unset($_SESSION);- don’t do that. php.net/manual/en/function.session-unset.php: “Caution: Do NOT unset the whole $_SESSION with unset($_SESSION) as this will disable the registering of session variables through the $_SESSION superglobal.”