When user logs in, record it on database.
And also record on database when the user logs out.
If a user tries to log in more than once at same time, (i.e. if database record shows that user is already logged in and hasn’t logged out yet), disallow log in and display message:
“Already logged in”