Re: Auth logging users out too quickly
| From: | Sylvain Gourvil | Date: | Thu, 30 Jun 2005 12:09:40 +0000 |
| Subject: | Re: Auth logging users out too quickly | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19842@lists.php.net to get a copy of this message | ||
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, PhilIdle 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