Re: OO Theory Question

From: Date: Tue, 17 Aug 2004 18:25:42 +0000
Subject: Re: OO Theory Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194068@lists.php.net to get a copy of this message
The real reason for having the login class like this is to eliminate database calls. I thought I could have one session variable that said yo uwere logged in, but then the database calls would still have to be made on each page. Thanks for the idea - any others? "Jason Davidson" <jdavidson@zworg.com> wrote in message news:29525.1092766813@zworg.com... > 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 (#194068) next »