for each and every user you give them login panal, and create colomn for activity
if user login scuessfully then u insert the database table as online, if he get logout then insert it offline to ur respective database.
If user does not show any activity for 10 min then logout autometically and insert it as offline.