REY619 Posted November 14, 2007 Share Posted November 14, 2007 I have a forum script, i want to show the total online time spent by the users on the site, from registration till now, in their profiles...The problem is i am unable to figure out the logic behind calculating the online time... I tried one method, but it only calculates the time for a single session.. when the session expires or the user logs out, and when he logs in again the time starts from the beginning and the previous online time is dumped... :)Have a look here, click on any profile it shows the total online time spent by the user in their profiles... http://wap.methos.co.za/forum/login.php?loguid=test&logpwd=test I want the same thing.. Can someone tell me the logic or algorithm behind it.. Please..Thanx.. Link to comment Share on other sites More sharing options...
Ingolme Posted November 14, 2007 Share Posted November 14, 2007 Well, you'd need to record it in a database each time they end their session. And each time you record it, add the time to the value that's already in the database. Link to comment Share on other sites More sharing options...
REY619 Posted November 14, 2007 Author Share Posted November 14, 2007 Hmm will i need to create two fields in the user table? One with the current session online time and other with the total online time? And each time the session expires the value in the session online time will be added in the total online time... And the value of the total online time will be displayed in the profile...But there is a catch.. The total online time in the profile wont be updated in the real time cos it will only be updated when the session expires or ends... :)Correct me if i am wrong...Thanx. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 14, 2007 Share Posted November 14, 2007 When you update the session time update the total time also. Link to comment Share on other sites More sharing options...
REY619 Posted November 15, 2007 Author Share Posted November 15, 2007 ^^hmm yes.. will try this..Thanx.. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.