Re: Login and Sessions

From: Date: Wed, 23 Apr 2003 13:59:32 +0000
Subject: Re: Login and Sessions
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-145012@lists.php.net to get a copy of this message
You will also need to implement your own garbage colection function and pass its name to session_set_save_handler (see www.php.net./session_set_save_handler ). This way you can remove the old sessions from db 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
     


« previous php.general (#145012) next »