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" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> put something in your script like
>
> if($_SESSION['authed'] == true)
>     $user = new User($_SESSION['userId']);
>
>
> or something similar.
>
> Jason
>
>
> "Jed R. Brubaker" <[EMAIL PROTECTED]> 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
> >
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to