Re: Auth object

From: Date: Sat, 16 Oct 2004 18:10:05 +0000
Subject: Re: Auth object
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14924@lists.php.net to get a copy of this message
On Sat, 16 Oct 2004 02:42:40 -0300, Eduardo Gargiulo <ejg-php.pear@ar.homelinux.org> wrote: > Justin Patrin <papercrane@gmail.com> wrote: > > > > On Thu, 14 Oct 2004 01:24:25 -0300, Eduardo Gargiulo > > <ejg-php.pear@ar.homelinux.org> wrote: > > > Hi all > > > > > > I'm using Auth 1.3.0r2 beta; the autentication method works right. > > > > > > I want to access methods and properties of the Auth object from all the pages of > > > my web system, because it has all the authentication data. Should I instantiate > > > the object in every php script? Which is the _right_ way to do that? Where can I > > > find detailed documentation on using the Auth package? > > > > > > > If you just need the info to be there, I'd suggest putting the object > > in the session. You could also have the existence of the object in the > > session mean that the user is authenticated. > > Yes, I put the object in $_SESSION, but the question is if I have to instantiate > an object Auth on every php where I want to use some method or property. For > example, > > $a = $_SESSION['a']; // $_SESSION['a'] is an authenticated session Auth > object > > when I try to use $a->getAuthData() I get an error, saying a is an unknown object. Should I > have to put > > $a = new Auth('DB','none'); > > before referencing Auth methods? > > thaniks in advance and sorry for my english > First off, are you including Auth.php before using the object? If not, that's the first problem. A second problem you may have is if it needs to connect to the DB. The connection will be stal in subsequent requests. Try it, but if it fails with DB errors you likely need to reinstantiate. -- paperCrane --Justin Patrin--

« previous php.pear.general (#14924) next »