Re: Login and Sessions
| From: | Marek Kilimajer | 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 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 heto log in from the same session, then this is already covered. TIA