Forum Moderators: coopster

Message Too Old, No Replies

resrticting one id login at a time

one user ID can be online ONLY from one place..

         

phparion

12:33 pm on May 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi

i want to make a user management system that has a rule "One user can login with his id only from one palce so that one id cannot be used from different places by different people to use the system"

very similar to hotmail messenger id, like you cannot login with same id from two PCs at the time and also gmail is doing the same now a days.

how can i make it? i had decided to use a boolean value that when a user logs in i will store "1" in database otherwise "0" would be stored in this coloumn, and during singing in step i will check this boolean value if it is "1" then it means id is already in use otherwise not in use...

and when a user will logout i will change "1" to "0" to make it available for logging in again.

BUT, now i have some logical problem and that is that what if some user abnormally shuts down the system without proper logout? then he will have "1" stored in coloumn and he would not be able to login again.... so i am stuck here...

Please guide me how to perform this task efficiently.

thanks in advance
__________________

Habtom

1:50 pm on May 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



//BUT, now i have some logical problem and that is that what if some user abnormally shuts down the system without proper logout? then he will have "1" stored in coloumn and he would not be able to login again.... so i am stuck here...

If the value is still 1 when one tries to login, I would have displayed some message :) The id is being used or improperly shutdown previously, and try to authenticate the person and give him access.

or better, check take the timestamp of the activities of the person who logged in to the system. If the time elapsed is more than some minutes, you can give access to that person, as he might have changed a PC or has forgotten to logout.

:) That was from the top of my head.

Hab

scriptmasterdel

2:08 pm on May 3, 2006 (gmt 0)

10+ Year Member



The way i would do it would be to create a new table called sessions with the fields :-

"user_id" or "user_name" and the "sesion_id"

Then when the user attempts to log in validate weather the user id is logged into the session table or not and if they are with a different session id then return the error as the session_id will not be the same.

Hope i have helped

Del

phparion

3:42 pm on May 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



the core problem is still there, i think.

what if someone abnormally shuts down the system and doesnt logout properly? then how will i do it?

does anyone have any idea that how Hotmail Messenger and Gmail is working now a days?

they are following the same pattern, one person can use on id only fron one place at a moment.

thanks

scriptmasterdel

4:04 pm on May 3, 2006 (gmt 0)

10+ Year Member



Once the browser has been closed the session is ended and obviously you would need a timestamp in the table (doy to me) and then if the session has been logged out for a certain amount of time then the session has ended.

Well i think i know what i am talking about :p

bye for now