Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 11-11-2007, 07:41 AM   #1 (permalink)
~[::BOoYaKa::]~
 
Join Date: May 2005
Location: In a Cave.
Posts: 575
Question Calculating Total Time Spent by users Online [PHP]


Can someone give tell me a php script or code to calculate the total time spent by a particular user on the site, from the time of registration till now..
The total time will be shown in the profile of the user....
It may involve both php/mysql if it needs.. I have tried everything but it doesnt sems to work..
If u want to see a demo what i am talking about, see here...
Code:
http://www.methos.co.za/login.php?loguid=test&logpwd=test
and click on any profile, there the total online time is shown...
Please help.. Thanx..
__________________
[::Eddie n Benoit Live Forever::]
REY619 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 11-11-2007, 11:06 AM   #2 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: Calculating Total Time Spent by users Online [PHP]

Um, store the session creation time and then the log-out time and that gives you the total time per session. And just keep adding the calculated time to get the total time?
QwertyManiac is offline  
Old 11-11-2007, 06:46 PM   #3 (permalink)
~[::BOoYaKa::]~
 
Join Date: May 2005
Location: In a Cave.
Posts: 575
Default Re: Calculating Total Time Spent by users Online [PHP]

Hmm yes, thanx, that could do the trick...
But will the time be updated in real time by this method? Cos the total time will be incremented only when the user logs out or the session expires...
__________________
[::Eddie n Benoit Live Forever::]
REY619 is offline  
Old 11-11-2007, 08:17 PM   #4 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: Calculating Total Time Spent by users Online [PHP]

Yeah you're right about that, but the only thing you can do closest to real-time monitoring would be to count the time between each page served to the user and set some averages for log-out/expire time.
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
Old 11-11-2007, 10:20 PM   #5 (permalink)
~[::BOoYaKa::]~
 
Join Date: May 2005
Location: In a Cave.
Posts: 575
Default Re: Calculating Total Time Spent by users Online [PHP]

hmm yes, will try and post the results...
Thanx..
__________________
[::Eddie n Benoit Live Forever::]
REY619 is offline  
Old 14-11-2007, 01:38 PM   #6 (permalink)
~[::BOoYaKa::]~
 
Join Date: May 2005
Location: In a Cave.
Posts: 575
Default Re: Calculating Total Time Spent by users Online [PHP]

I tried doing it, it works, but it only stores the time for a single session. When user logs out, or the session expires, and when the user logs in again, it starts the time again from the starting and the previous online time is lost...
Tried doing everything but cant figure out the logic..
__________________
[::Eddie n Benoit Live Forever::]
REY619 is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can anyone tell me whats the total number of internet users hellomotto Internet & WWW 1 07-06-2006 12:09 PM
how much money have u spent? paul_007 Gamerz 24 07-01-2006 06:14 AM
calculating the time, larger matrices! help pls. legolas QnA (read only) 2 13-10-2005 09:14 AM
log time stamp for users in xp pro taken QnA (read only) 1 06-09-2005 08:06 PM

 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2