Jump to content

how to detect user online/offline?


zgkhoo

Recommended Posts

what I did was when a user logs in the online column turns to a value of 1

then on the top of each page I have the timestamp column updated, but if that timestamp hasn't been updated in more than 10 minutes I switch the online column to 0

 

Link to comment
Share on other sites

you could create a $_SESSION variable with the username, or ID whatever. and have that inserted into your MySQL database, and if it isn't set on whatever page they go to, you remove it from the database and log them out, but their is always the other small problems that come to mind.

 

what if they close the browser?

 

what if they don't log out?

 

what if they don't login and hack the URL?

 

Your best bet is probably to Try google and try and find a OOP script that works Sessions with MySQL, their are a few out their. The only really tricky part is setting them up.

 

Regards ACE

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.