foyer wrote:
You could have a column in your database user table for instance, LoggedIn.
While that would work it is best to avoid modifying a table unnecessarily. Especially such a key table as user login info.
ixalmida's suggestion would work. You will just want to use a separate table and you wil need to add a time stamp to that table and then check it to see if a user has a recently (you define recently) logged in under a different IP.
Also you can create a unique id to be stored in a $_SESSION variable and in the database, each time they login. And each page load just check it against the current one in the database for that account. Of course don't ever allow 2 entries in the database with the same user id.
Now you do have one small problem in that account sharing may still occur if both are not logging in at the same time. It should be noted that multimillion dollar companies can't stop account sharing.