[PHP] User Authentication / only 1 login per user at any time

2001-09-10 Thread Lewi Hirvela

Hi, 

With most of my scripts, when I am about to write something, I have it in my
head on how to do it exactly.. But with only 1 login per user at anytime, I
havent found any good ways to do it,

All I can think of is to set a mysql field called ³logged_in² to ³1² or ³0²
if logged in or not, but the problem with that is if you close the browser ,
it will stay ³logged_in=1²  ,

Is the way around that problem to do some sort of timeout code that checks
all ³logged_in² in the whole table and also a field where it logged the last
time the user accesses a page, to see if the user has accessed a page within
20 minutes .. Or is there a better way to do it?
Thanks,
Lewi



Re: [PHP] User Authentication / only 1 login per user at any time

2001-09-10 Thread Michael Kimsal

Hi there:

We have this functionality built into our core framework
with our custom session handling.  The basic premise is that you don't 
store a
1/0 in a 'logged in' flag, but store the session key with the username.  

When someone logs in, assign their session key to that username.  The
previous session key associated with that username will be overwritten,
and that user will no longer be able to do anything, because they have
no data associated with their session.


To do it like this, you'd need to come up with your own mechanism for 
deciding
if someone was no longer valid - we tie that to session data.  No 
session data,
no access.  

If I log in with your username, you are guaranteed to be 'kicked off'.  


Hope that helps...

Lewi Hirvela wrote:

Hi, 

With most of my scripts, when I am about to write something, I have it in my
head on how to do it exactly.. But with only 1 login per user at anytime, I
havent found any good ways to do it,

All I can think of is to set a mysql field called ³logged_in² to ³1² or ³0²
if logged in or not, but the problem with that is if you close the browser ,
it will stay ³logged_in=1²  ,

Is the way around that problem to do some sort of timeout code that checks
all ³logged_in² in the whole table and also a field where it logged the last
time the user accesses a page, to see if the user has accessed a page within
20 minutes .. Or is there a better way to do it?
Thanks,
Lewi 



Michael Kimsal
http://www.tapinternet.com/php
PHP Training Courses
734-480-9961


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]