User must need to be login in one system at any instant

hi

iam sunil,

user must need to be login in the site at any instant.

i mean if one user id(eg: sunil1216) is logged in one system, same user id(eg: sunil1216) cant logged in untill unless the user id( eg: sunil1216 ) logged out.

i dont know what the name of this concept.

iam doing in php. actually when user id is in idle mode for 20 mins, the session is destroying automatically by itself. kindly send me details how it is destroying.

its very urgent to complete this task, as iam fresher iam unable to do this, please send how to do this.

Thanks in advacne
sunil:)

There’s not enough info in the OP to know, but I’m tentatively siding with logic_earth, which is why I didn’t reply - the concept seems silly, and they shouldn’t have them because it breaks usability :slight_smile:

And that still makes no sense. Why would two users have the same account? Even so, why can’t both be logged in at the same time?

I cannot send you personally any such codes but here is what you can do:

  • Have a field in the database table (login check table) as status with default value 0.
  • Set this status field 1 after login
  • And check each time someone tries to login if the status field is already has the value 1 then tell them that “You are already logged in. If you want to login then you must logout first.”.
  • For login to stay only for certain minutes then you can set with the function session_cache_expire(). Or read this page http://www.php.net/manual/en/book.session.php for more detail on php sessions.

Hope you can manage logout system when session expire by checking some session variables.

I would think the best solution to this is used a database session handler. If you did that, whenever a user tries to login, you can look at the session table and see if that user has an active session. If they do, flag it to be destroyed. Also, whenever a user takes an action you can check it against the time the last action was taken, if it’s over 20 minutes destroy the session. If not, take the action and update their time.

So wait…let me get this straight because I speak English not whatever it is you just wrote. You have multiple sites that share account information? And a user can only be logged into one of these sites at a given time? Otherwise why would the user try and log in again if already logged in…that doesn’t make any sense.

From what I can tell, what the poster is wanting to do is make it so you can’t have 2 people logged into one account at the same time on their site, and if there’s an active session for a given account and another user logs into that account, the first session needs to be destroyed to limit an account to one user at a time.

It could be seen as a security feature. It would let you know if someone is logging into your account to see what you’re doing.
Even so, the why isn’t nearly as important as the how.
If the poster wants single user account sessions, why shouldn’t they have them?