Re: Re: Auth logging users out too quickly
| From: | Sylvain Gourvil | Date: | Thu, 30 Jun 2005 12:53:11 +0000 |
| Subject: | Re: Re: Auth logging users out too quickly | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19845@lists.php.net to get a copy of this message | ||
Phil Gyford wrote:
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:I do not know a way to do that but there is ! Be careful about security and authentification in this case. Perhaps you can with cookies, etc but I do not use those things at all. Tell me if you find something ! ;-) Bye ! Sylvain Gourvil Antiquités en France Développeur PHP, PostGreSql, PEAR, SmartyPhil 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 {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.phpfunction 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