Q: sessions in a switch block not working
| From: | Joe Rice | Date: | Mon, 25 Feb 2002 06:15:56 +0000 |
| Subject: | Q: sessions in a switch block not working | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-86112@lists.php.net to get a copy of this message | ||
Hello,
I'm hoping to get some help with a sessions problem i've
ran into. track_vars is enabled and register_globals is off.
i'm using PHP 4.0.6 and custom session handlers with ADODB
connecting to mysql.
at the top:
session_start();
if (!isset($HTTP_SESSION_VARS["old_folder"])) {
echo "NOT SET<br>\n";
$HTTP_SESSION_VARS["old_folder"] = 1;;
} else {
echo "IT IS SET: {$HTTP_SESSION_VARS["old_folder"]}<br>\n";
}
-----
in the middle of a switch statement:
$nasty_folder = $HTTP_GET_VARS["folder"];
$HTTP_SESSION_VARS["old_folder"] = $HTTP_SESSION_VARS["old_folder"] + 444;
if (isset($HTTP_SESSION_VARS["old_folder"])) {
echo "ADDED 444: {$HTTP_SESSION_VARS["old_folder"]}<br>\n";
} else {
echo "FAILED TO ADD<BR>\n";
}
---
first time through it prints "NOT SET".
second time, without finding my way into the switch it prints "IT IS SET: 1".
third time, before going into the case with + 444, it prints "IT IS SET: 1", then
i make it into the case and promptly prints "ADDED 444: 445" as the next line.
fourth time, i would expect "IT IS SET: 445" without worrying about where i
wonder in the switch. can anyone tell me why this isn't working?
i do have many lines of code in between but, none deals with HTTP_SESSION_VARS.
the only other use i'm making of sessions is setting $uID = $HTTP_SESSION_VARS["uID"]
well before the switch statement. $HTTP_SESSION_VARS["uID"] gets set many pages
and other PHP scripts before and i just reuse it (as sessions were intended).
any help would be greatly appreciated.
thanks,
joe
--
How do i get rid of those words in my screen that are coming from you?