* Thus wrote Jed R. Brubaker:
> 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.

page1:
require_once('class.login.php');
$login = new login();
$_SESSION['login'] = $login;

page2: 
require_once('class.login.php');
$login = $_SESSION['login']: 
echo $login->userType;

see http://php.net/oop.serialization


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

Reply via email to