Jump to content

monitor total user active time on your website


atomsk

Recommended Posts

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]

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.

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*/
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.