• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Get online time of user

Alex__

Active member
#1
i would like to get the online time of users, to measure how long they are online, but i dont know how to approach this in a performant way.

i have seen such counters in smf, ipb etc already.

anyone has an idea?
would be much appreciated :)
 

Alex__

Active member
#3
yes, have seen that. :D

thought into hooking that, but it is quiet difficult for me to get the exact seconds the user spends online.

still, thank you very much for reminding me about that again, doing to examine the code behind it again, maybe there is something i missed, when i looked at it the first time :)
 

EQnoble

Well-known member
#4
I don't think you could be 100% accurate and get exact seconds unless you make some kind of ajax call on every page every second which would incrementally increase a value in the db for something like time_online, on the other hand if you were to round the ajax polling to like 45 seconds or a minute you could probably do something with it that wouldn't kill your db with constant writes for every online user every second.
 

Alex__

Active member
#5
yes, thats exactly what i worried about.

i really think the best approach is to measure the online timeout or some kind of that.

thanks!