Re: Login and Sessions

From: 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 Sessions
No, sessions aren't going to be the answer here. You're best bet it to
use a database to
store some boolean for where the user is actively logged in or not. Then
when they try to
login you'd have to query the appropriate table to determine then if you
wanted to
continue on to test the authentication mechanism. -- der Ritter aka: Jason k Larson C.R. wrote:
I have a login script which uses sessions and want to implement
something
that would allow a user to only log in once (this could be depending on
IP
or user name - I haven't decided how I want to go yet). I would
appreciate
any 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 to
do
this. If I have 100 users logged in and one of them tries to log in
again -
how would I check this against the sessions already set? This is assuming the user opens a new browser to log in again. If he
tries
to log in from the same session, then this is already covered. TIA
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#145014) next »