Re: OO Theory Question

From: Date: Tue, 17 Aug 2004 18:20:13 +0000
Subject: Re: OO Theory Question
Groups: php.general 
Request: Send a blank email to php-general+get-194067@lists.php.net to get a copy of this message
put something in your script like if($_SESSION['authed'] == true) $user = new User($_SESSION['userId']); or something similar. Jason "Jed R. Brubaker" <jrb21398@hotmail.com> wrote: > > Hi all! I could use some perspective on a project that I am currently > working on. > > I am trying to utilize OO to make my PHP easier, but I keep running into > problems that revolve around the stateless nature of the web. > > Consider the following: I have a login class that is instantiated at the top > of every page. It can log you in, check to see if you are logged in, etc. > This class has an assortment of class variables such as userID, userType, > etc. > > It would be great if I could make a reference to $login->userType on any > given page, but I run into errors as the login class gets reinstantiated on > every page. > > A solution is to set all of these variables into $_SESSION, but the appeal > of classes is that I might be able to maintain all of my information in a > related location, and not in the session. > > I am sure that this is a problem that many of you more experienced (than I) > developers have run into. Is there a solution? And ideas? > > Thanks in advance! > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#194067) next »