Session Problems, What Gives?
| From: | Ben Lanson | Date: | Sat, 14 Oct 2000 20:30:26 +0000 |
| Subject: | Session Problems, What Gives? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20166@lists.php.net to get a copy of this message | ||
I've distilled my session problems down to simple test files, and I now
know what is happening, though not why.
test.php
<?
session_start();
session_register("testvar");
session_register("testvar2");
$testvar = "$REMOTE_ADDR";
$testvar2 = "HELLO WORLD";
$sid = session_id();
print("<A HREF='test2.php?SID=$sid'>NEXT</A>");
?>
test2.php
<?
session_start();
$this_sid = session_id();
echo $this_sid;
echo $testvar;
echo $testvar2;
?>
Now, in IE and in Netscape with cookies on, this code works. If I turn
cookies off, it fails. With cookies off, test2.php appears to be
generating a new session (this_sid no longer matches the SID passed in the
url). Hence, no variables are accessible. I am running 4.02 and I did not
compile with --enable-track-vars, but it is set to "On" in php.ini. Use
cookies is set to 0. Session.name is set to "SID".
Note that identical code runs properly regardless of browser cookie
settings on a box running 4.0, with an identical php.ini.
Can anyone tell me what I am missing? I can't find anything in the
documentation that suggests why this might be happening.
Ben