PHP401 - session info request...
| From: | fredo | Date: | Sat, 01 Jul 2000 18:23:39 +0000 |
| Subject: | PHP401 - session info request... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-4280@lists.php.net to get a copy of this message | ||
Hi.
I'm playing around a bit with sessions and have the next
problems/questions :
* why do session variables need tobe declared as global ones and
* why do i have to set globals_register = on in php.ini to make it work and
* why doesn't $HTTP_STATE_VARS work, even when the online documentation
clearly refers to it
Wouldn't it be logical if session variables are normal localy declared? And
for performance gain as the php.ini states, why can't we use those session
info
with globals_register = off by using $HTTP_STATE_VARS?
Thx for reading...
ps. I'm using NT4.SP6a/Apache1.3.12/PHP4.0.1.pl2
--------------test.php--------------------------------------------------
<?
// global $test;
$test = 3;
session_start();
session_register("test");
echo(sprintf("<p><a href=
\"test_2.php?%s\">click</a></p>", SID));
?>
--------------test.php--------------------------------------------------
-------------test_2.php------------------------------------------------
<?
session_start();
// echo $HTTP_STATE_VARS["test"];
if ( session_is_registered("test") )
{
echo ++$test;
}
else
{
echo "not registered...";
}
echo(sprintf("<p><a href=
\"test_2.php?%s\">click</a></p>", SID));
?>
-------------test_2.php------------------------------------------------