global variable in classes

From: Date: Fri, 15 Sep 2000 06:10:36 +0000
Subject: global variable in classes
Groups: php.general 
Request: Send a blank email to php-general+get-16937@lists.php.net to get a copy of this message
Hi, I have a problem with global variable and classes for handling something like session time out. Bassically, this is how it works. Each application has something like $SESSION as global variable, passed through the URL argument. Each application will make a new instance of class, something like: $myapp = new app("ARGS"); app class will call a new instance of session class $ses = new session($SESSION); Bassically, session class will check if $SESSION is still valid (eg. not expired yet). If it's expired, it will do $SESSION = 0, and call a login form, and then exit. Now my question is, although I set the global variable $SESSION=0 in session class, somehow, the next time I call app class, the $SESSION in app class is not 0 (eg. the expired SESSION), and thus when app class call session, it checks the $SESSION again which was expired, and call a login form again, and I'm trapped in a loop that give me a login form all the time. Bassically, I set $SESSION = 0 in session class, but $SESSION!=0 in app class after I set it to 0 (in session class). The session.inc file is included in app.inc file. Has anyone run into something like this before? I've spent hours trying to figure this thing out. So, any help, suggestion will be greatly appreciated. Thanks Reuben D. Budiardja -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ "God is the unrestricted act of understanding, the eternal rapture glimpsed in every Archimedean cry of Eureka."
                     	- Bernard Lonergan -
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ Reuben Donald Budiardja reubendb@goshen.edu Homepage: http://www.goshen.edu/~reubendb

« previous php.general (#16937) next »