title: How to Prevent Concurrent User Logins in PHP/MySQL Site?
body: <p>I am developing the user management portion of a website that will host a webcast.  The goal is to prrevent the same user nam (email address) from being used concurrently.  That is, we don't want two individuals using one login to view the event.  </p>
  
  <p>I've already setup a table that holds the user registration data with regID as primary key.  My thought is to create a login history table with username as primary key, foreign key to user name in registration table.  The login history table would simply timestamp when the user logs into the site.  However, this won't accomplsih my goal of preventing more than one individual from using the same login name.  </p>
  
  <p>Instead, would it be better to have a login status field either in the login history or user table that is set to 1 for logged in and 0 for logged out?  It would need a stored procedure to update the value at login and at logout, and would need to be validated when a user logs in such that if login status = 1, user already logged in and cannot login a second time.  Is this a feasible approach?</p>
  
  <p>Please share other methods you've used to prevent the same login credential from being shared amongst multiple individuals.</p>
  
  <p>Thanks,
  Sid</p>