Re: Login and Sessions
| From: | Jonathan Pitcher | Date: | Wed, 23 Apr 2003 14:14:35 +0000 |
| Subject: | Re: Login and Sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145014@lists.php.net to get a copy of this message | ||
C.R.
You could have a field like last_active stored in the database for each user.
Then have a setting called delay_time. This holds the amount of time till you think a user is idle.
Each time a user loads a page you update their active time to the current time.
Each time a user logins you compare their last_active + delay_time to current time. If they are greater then the user is logged in.
Hope this helped.
Jonathan Pitcher
On Wednesday, April 23, 2003, at 08:37 AM, C.R. wrote:
I thought about using the database, but that causes a problem. If the user does not log out properly from the site then the next time he tries to log in, the database will already show him as logged in. With a session, it will expire when he closes the browser or it times out. This is why I thought this would be a better option. Is there a way to search active sessions for a particular session, or would that be too much overhead to do this. C.R. ----- Original Message ----- From: "Jason k Larson" <jlarson@candlefire.org> To: "C.R." <odcs@rogers.com> Cc: "PHP General" <php-general@lists.php.net> Sent: Wednesday, April 23, 2003 2:50 AM Subject: Re: [PHP] Login and SessionsNo, sessions aren't going to be the answer here. You're best bet it touse a database tostore some boolean for where the user is actively logged in or not. Thenwhen they try tologin you'd have to query the appropriate table to determine then if youwanted tocontinue on to test the authentication mechanism. -- der Ritter aka: Jason k Larson C.R. wrote:somethingI have a login script which uses sessions and want to implementIPthat would allow a user to only log in once (this could be depending onappreciateor user name - I haven't decided how I want to go yet). I woulddoany feed back on how this could be accomplished. I would like to use the session that is already set for a particular user, but not sure how toagain -this. If I have 100 users logged in and one of them tries to log intrieshow would I check this against the sessions already set? This is assuming the user opens a new browser to log in again. If he-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpto log in from the same session, then this is already covered. TIA