Session with Navigator Previous Button

From: Date: Thu, 02 Nov 2000 18:05:09 +0000
Subject: Session with Navigator Previous Button
Groups: php.general 
Request: Send a blank email to php-general+get-23424@lists.php.net to get a copy of this message
Hello, I'm a newbie with the following software (PHP 4.0.2, Apache 1.3.14, Linux Mandrake 7.0). I try to manage the session without cookies but i have a problem. I have 3 pages : - page 1 ("testid1.php") with a link on page 2; - page 2 ("testid2.php") with a link on page 3 and a link on page 1; - page 3 ("testid3.php") with a link on page 2; i test on localhost with Netscape® Communicator 4.7 with 2 differents settings : - with cookies, - without cookies. When i allow cookies , i understand what it happens : + i call http://localhost/testid1.php + i click on the link and i go on page "testid2.php", + i click on the link and i go pn page "testid3.php", + when i click on the Navigator's Previous button, i come back with the SAME session_ID until the first page "testid1.php". When i disable cookies, i don't understand what it happens : + i call http://localhost/testid1.php + i click on the link and i go on page "testid2.php" : (if i click on the link for the page 1, i go to the page 1 with the same session_ID), + i click on the link and i go pn page "testid3.php", + when i click on the Navigator's Previous button : - i come back from "testid3.php" to "testid2.php" with the same session_ID - i come back from "testid2.php" to "testid1.php" with A DIFFERENT session_ID, and my session variables are new !! I don't understand how i can keep the session_ID and the session variable in this case. If someone can help me, thank you because i've no solutions. Jean-Stéphane Lebrun PS : i attach at this message the the source of the 3 pages. You can replace <?=SID?> by <?echo session_name() ."=". session_id(); ?>, it's the same result. /* * testid1.php */ <? session_start(); echo "Le numéro de session : " .SID. "<BR>"; echo "testid1.php session : " .session_name(). " " .session_id(). "<BR>"; if (session_is_registered("toto")) { echo "toto est déjà dans la session : $toto<BR>"; } else { $toto="c'est toto !"; session_register("toto"); echo "toto vient d'être rajouté à la session : $toto<BR>"; } ?> <A HREF="testid2.php?<?=SID?>"> Page suivante </A> /* * testid2.php */ <? session_start(); echo "Le numéro de session : " .SID. "<BR>"; echo "testid2.php session : " .session_name(). " " .session_id(). "<BR>"; if (session_is_registered("toto")) { echo "toto est deja dans la session : $toto<BR>"; } else { echo "toto n'est pas dans la session<BR>"; } if (session_is_registered("tata")) { echo "tata est deja dans la session : $tata<BR>"; } else { echo "tata n'est pas dans la session<BR>"; } ?> <A HREF="testid1.php?<?=SID?>"> Page precedente </A> <A HREF="testid3.php?<?=SID?>"> Page suivante </A> /* * testid3.php */ <? session_start(); echo "Le numéro de session : " .SID. "<BR>"; echo "testid3.php session : " .session_name(). " " .session_id(). "<BR>"; if (session_is_registered("toto")) { echo "toto est deja dans la session : $toto<BR>"; } else { echo "toto n'est pas dans la session<BR>"; } if (session_is_registered("tata")) { echo "tata est deja dans la session : $tata<BR>"; } else { $tata="Ce coup la, c'est tata !!"; session_register("tata"); echo "tata vient d'être rajoutée à la session : $tata<BR>"; } ?> <A HREF="testid2.php?<?=SID?>"> Page precedente </A>

« previous php.general (#23424) next »