Auth logging users out too quickly
| From: | Phil Gyford | Date: | Thu, 30 Jun 2005 10:55:16 +0000 |
| Subject: | Auth logging users out too quickly | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-19841@lists.php.net to get a copy of this message | ||
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