Session problems...

From: Date: Fri, 19 Mar 2004 18:17:39 +0000
Subject: Session problems...
Groups: php.general 
Request: Send a blank email to php-general+get-180988@lists.php.net to get a copy of this message
I thought I had a pretty good handle on sessions, but I can't figure out what could possibly be going wrong in this case. I've stripped my code down to basically the bear minimum which still reproduces the problem, which I included below. When I visit test1.php with the url: http://domain&path/test1.php?name=bill&pwd=henry I see the output: user = 'bill' ID= 41699d4461e8fe3a71243bb3cb1c2298' You were remembered and are now being redirected to the home page. If this fails for some reason (and if you are seeing this, it probably has), please click here: To Home Page However, upon redirection to test2.php, I see: '' 31e2cab461dc525ea9a8c22e5d997db5 The session ID appears to have changed. Any idea why? I can use sessions in other situations with any problems... test1.php -- <?PHP session_start(); $isRemembered = false; $rememberedUser = ""; $username = $_GET[ 'name' ]; $password = $_GET[ 'pwd' ]; $isRemembered = true; $rememberedUser = $username; $_SESSION[ "validUser" ] = $rememberedUser; $sessionID = strip_tags( SID ); echo "<html>"; echo "<head>";
    echo "<title>";
    echo "User Login";
    echo "</title>";
    echo "<script language=\"JavaScript\">";
    echo "window.setTimeout( 'window.location=\"http://www.ericgorr.net/advciv/test2.php\"', 5000 );";
    echo "</script>";
echo "</head>"; echo "<body bgcolor=#eeeeee>";
    echo "user = '" . $_SESSION[ "validUser" ] . "'<br>";
    echo "ID= " . session_id() . "'<br>";
    echo "You were remembered and are now being redirected to the home page. If this fails for some reason (and if you are seeing this, it probably has), please click here: ";
    echo "<a  href = \"HomePage.php\">To Home Page</a>";
echo "</body>"; echo "</html>"; ?> -- test2.php -- <?PHP session_start(); echo "<html>"; echo "<head>"; echo "</head>"; echo "<body bgcolor=#eeeeee>"; echo "'" . $_SESSION[ "validUser" ] . "'<br>" . session_id() . "<br>"; echo "</body>"; echo "</html>"; ?> --

« previous php.general (#180988) next »