REY619 0 Posted November 14, 2007 Report 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.. Quote Link to post Share on other sites
Ingolme 1,035 Posted November 14, 2007 Report 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. Quote Link to post Share on other sites
REY619 0 Posted November 14, 2007 Author Report 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. Quote Link to post Share on other sites
justsomeguy 1,135 Posted November 14, 2007 Report Share Posted November 14, 2007 When you update the session time update the total time also. Quote Link to post Share on other sites
REY619 0 Posted November 15, 2007 Author Report Share Posted November 15, 2007 ^^hmm yes.. will try this..Thanx.. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.