atomsk Posted March 29, 2007 Share Posted March 29, 2007 Any scripts that can be easily modified for this type of facility? I need a script that stores user session time and then adds them to display the total time a user has been active on my website. cheers Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/ Share on other sites More sharing options...
DeathStar Posted March 29, 2007 Share Posted March 29, 2007 Use UNIX_TIMESTAMP() to do this. Log it on everypage, then you can display it again on other && count it to see who' has been active in last 10 mins so on. it works like this: [b]60 * 60 = 3600 = 1 hour 60 * 60 * 24 = 86400 = 1 day 60 * 60 * 24 * 15 = 1296000 = 15 days[/b] Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-217351 Share on other sites More sharing options...
atomsk Posted March 29, 2007 Author Share Posted March 29, 2007 Eh let me rephrase. I need a facility for an admin to monitor the users that are registered with the website Here's my requirements: Make a page log that displays the total online time in system for each user since registration/first login date. e.g. User Name Time Online Registration Date Last Login John 234h 23m 12/1/2007 22/3/07 Paul 123h 12m 17/2/2007 25/3/07 Mary 331h 45m 12/11/2006 3/3/07 . . . . . . . . Provide a facility for that log page to display online time for specific day or dates. For instance there should be 3 text fields for entering user name, from_date and to_date. Some sort of basic form validation should exist if user enters the wrong user name or dates or nothing at all. The result page should return something like the following. User John has been online for 12 hours and 43 minutes from 20/3/2007 to 23/3/2007. or User Maria has been online for 3 hours and 22 minutes on 12/1/2006. (if only one date is given). All these should be accessible from admin logs. Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-217360 Share on other sites More sharing options...
DeathStar Posted March 29, 2007 Share Posted March 29, 2007 I'm Really Not going to write the code for you!! Same , with just calculations! Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-217629 Share on other sites More sharing options...
boo_lolly Posted March 29, 2007 Share Posted March 29, 2007 here's an example: <?php /*when user logs in*/ $_SESSION['time'] = time(); /*when user logs out*/ $time_this_session = time() - $_SESSION['time'] /*execute code to grab current amount of time, and add $time_this_session to that entry*/ ?> Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-217716 Share on other sites More sharing options...
DeathStar Posted March 30, 2007 Share Posted March 30, 2007 Your being to kind XD Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-218253 Share on other sites More sharing options...
boo_lolly Posted March 30, 2007 Share Posted March 30, 2007 Your being to kind XD oh i don't know about that =). i'm sure atomsk still has at least a few errors to work through before he can get it to work. Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-218362 Share on other sites More sharing options...
DeathStar Posted March 30, 2007 Share Posted March 30, 2007 Your being to kind XD oh i don't know about that =). i'm sure atomsk still has at least a few errors to work through before he can get it to work. still.. Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-218374 Share on other sites More sharing options...
Rottingham Posted March 30, 2007 Share Posted March 30, 2007 My question would be... how to tell when they left the site, if they did not use the logout feature. Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-218423 Share on other sites More sharing options...
DeathStar Posted April 1, 2007 Share Posted April 1, 2007 umm.. try the onload.. ex: <body onunload=\"notlogedout()\"> Link to comment https://forums.phpfreaks.com/topic/44758-monitor-total-user-active-time-on-your-website/#findComment-219317 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.