Re: Re: Auth logging users out too quickly
| From: | Phil Gyford | Date: | Thu, 30 Jun 2005 12:27:39 +0000 |
| Subject: | Re: Re: Auth logging users out too quickly | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19844@lists.php.net to get a copy of this message | ||
Ah, thanks for the clear explanation Sylvain!
Is there a way to keep people logged in for a longer time using Auth?
If not, what's the simplest way to allow this to happen? (I remember
looking at LiveUser some time ago when deciding how to do
authenticaion stuff and it seemed overkill for what I needed at the
time.)
Thanks,
Phil
On 6/30/05, Sylvain Gourvil <opensource_france@yahoo.fr> wrote:
> Phil Gyford wrote:
> > Hi,
> >
> > I'm using Auth to do all my logging in/out of users, and it works
> > fine. Except... I want people to remain logged in even if they come
> > back to the site in a few days. But it always seems to log people out
> > if they're idle for a short while (a matter of hour(s) I think), never
> > mind returning the following week.
> >
> > I'm using it like this:
> >
> > class Person_Global extends DataObjects_Person
> > {
> > function Person_Global ()
> > {
> > global $PAGE;
> >
> > // Do we have to be logged in for this page?
> > if ($PAGE->loginrequired) {
> > $show_login = true;
> > } else {
> > $show_login = false;
> > }
> >
> > $this->Auth = new Auth(
> > 'DB',
> > array (
> > 'dsn' => DATABASE,
> > 'table' => $this->__table
> > ),
> > 'login_function',
> > $show_login
> > );
> >
> > // Time out after a month.
> > $this->Auth->setExpire(30*86400, false);
> > $this->Auth->setIdle(30*86400, false);
> >
> > $this->Auth->start();
> >
> > // Set this user's info.
> > $this->get('username', $this->Auth->getUsername());
> >
> > }
> > }
> >
> > Anything obviously wrong? I must admit that I've never quite
> > understood the difference between Expire and Idle, hence my attempt to
> > set them both very high... any help would be appreciated.
> >
> > Thanks,
> > Phil
>
> Idle is set to default value each time the user do something on the web
> site.
> Expire is the longest time he can stay whatever he does.
> So you can define an expire time of one hour and an idle time of 10 minutes.
> If the user doesn't do antyhting during the first minute, and click on a
> link using PEAR Auth, he will have ten minutes to do another action and
> not 9.
>
> But if he session is destroy, it is finished.
> What you want is not what you implemented.
> When, the user disconnect or close his browser, the session is
> automatically destroy so he has to reconnect the next time !
>
> Sylvain Gourvil
> Antiquités en France
> Développeur PHP, PostGreSql, PEAR, Smarty
>
>
>
>
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>