Re: Auth object
| From: | Eduardo Gargiulo | Date: | Sat, 16 Oct 2004 05:42:40 +0000 |
| Subject: | Re: Auth object | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14923@lists.php.net to get a copy of this message | ||
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
--ejg