Multiple sessions

From: Date: Wed, 12 Jul 2006 13:36:20 +0000
Subject: Multiple sessions
Groups: php.general 
Request: Send a blank email to php-general+get-239351@lists.php.net to get a copy of this message
Hi. Is there a way to have multiple sessions open in one browser (specifically, Firefox or Safari)? For example, IE does not transfer session data from one window to another, however, Firefox does. So, if one user opens a session and then his/her friend wants to open a different session of that same program on the same computer, (s)he is not able to without overwriting the first session data. I have thought of one solution, but have yet to test it. Upon the first user logging in, I could assign them as session ID (along with the one that PHP creates). I could then verify that ID is being used on each page. For the second user, I could create a different one and do the same as the first. ???? <? // User 1 $_SESSION["my_special_id"] = abcd; // created upon logging in if ($_SESSION["is_logged_in"] &&
    $_SESSION["my_special_id"] == $_GET["my_special_id"]) {
    // do stuff
} ?> <? // User 2 in a different window of Firefox $_SESSION["my_special_id"] = efgh; // created upon logging in if ($_SESSION["is_logged_in"] &&
    $_SESSION["my_special_id"] == $_GET["my_special_id"]) {
    // do stuff
} ?> Notice that they both share the same "is_logged_in" variable, but a different "my_special_id" variable. Actually, I just noticed something. If User 1 logs out and kills "is_logged_in", that would also kill it for User 2. I don't know. I've confused myself now. Any suggestions? Common practices? Thanks in advance, ~Philip

« previous php.general (#239351) next »