1

How can I Detect, if user is logon on other device at same time.

I have tried by saving and comparing SessionID on database while login.

But in-case of abnormal logout like 'closing browser without logout' or 'session timeout', I think its nearly impossible to clear sessionid history from database.

I have googled, but didn't find any concrete answer. Is there any other way to achieve this?

10K35H 5H4KY4
  • 1,496
  • 5
  • 19
  • 41
  • Maybe, you could use constraits in the db as UNIQUE field (for user_id in session table) for integrity. The client log in with credentials like, email, username, facebookID, you can search this in the users table and then search in session table. – brunocascio Sep 07 '15 at 01:19
  • Hi @brunocascio, sorry I didn't quite understand your suggestion. How do you clear entry from session table on abnormal logouts? – 10K35H 5H4KY4 Sep 07 '15 at 01:34
  • You should use cron jobs or sql events.. check this: http://stackoverflow.com/a/21197783/2723301 Add a timestamp field and in the sql query, check if timestamp is older. – brunocascio Sep 07 '15 at 12:31

0 Answers0