note 11548 modified in ref.session by yohgaki
| From: | yohgaki@php.net | Date: | Sat, 19 Jan 2002 06:39:37 +0000 |
| Subject: | note 11548 modified in ref.session by yohgaki | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25109@lists.php.net to get a copy of this message | ||
-->session objects part II:
I got this to work, if you are also having problems with sessions with register_globals turned off
and none of the other suggestions work, you may as well give it a try:
class session_variables{var $count=0;}
session_start();
if (isset($HTTP_SESSION_VARS["z"]))
$z=&$HTTP_SESSION_VARS["z"];
else {
$z=new session_variables();
$HTTP_SESSION_VARS["z"]=&$z;
}
print $z->count++;
--
Editor's note: Original code uses session_is_registered(). DO NOT USE session_register(),
session_is_registered() and session_unregister(), if you are using $HTTP_SESSION_VARS/$_SESSION.
--was--
-->session objects part II:
I got this to work, if you are also having problems with sessions with register_globals turned off
and none of the other suggestions work, you may as well give it a try:
class session_variables{var $count=0;}
session_start();
if (session_is_registered("z")) $z=&$HTTP_SESSION_VARS["z"];
else {$z=new session_variables();$HTTP_SESSION_VARS["z"]=&$z;}
print $z->count++;
http://www.php.net/manual/en/ref.session.php