Jump to content

Total Time Logged In??


Scropion

Recommended Posts

This can get more complicated the more accurate ou want to be,

 

To start you off you want to record the unix timestamp, eg: time();

 

time() is the current time in seconds (since a specific date called the unix epoch).

 

if you were able (through ajax maybe?) to tell when a user disconnected/closed their browser, you could use the first time() call taken away from a new time() call, would give you the secods that user was on the website.

 

Though the easiest and i think best way would be to use a timer, since people sometimes leave a browser window on a website for days without closing it (or is it just me? lol), the could be online for 1 minute but it says a day, so you need a timeout, if the user is not active within 5 minutes of the last recorded activity, only add 5 minutes of activity (about 5 minutes to read the page).

 

I hope this helps,

Link to comment
https://forums.phpfreaks.com/topic/142065-total-time-logged-in/#findComment-744066
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.