htdocs/ajax-active.php
changeset 52 a8f0e99883d1
equal deleted inserted replaced
51:508400fc5282 52:a8f0e99883d1
       
     1 <?php
       
     2 
       
     3 require_once('../stats-fe.php');
       
     4 require_once('../timezone.php');
       
     5 
       
     6 if ( !isset($channel) )
       
     7 {
       
     8   $channel_list = stats_channel_list();
       
     9   $first_channel = $channel_list[0];
       
    10   $channel = ( isset($_REQUEST['channel']) && in_array($_REQUEST['channel'], $channel_list) ) ? $_REQUEST['channel'] : $first_channel;
       
    11 }
       
    12 
       
    13 ?>
       
    14     <h1>Active members</h1>
       
    15     <p>For the last 1, 5, and 15 minutes:
       
    16         <?php echo count(stats_activity_percent($channel, 1)) . ', ' .
       
    17                    count(stats_activity_percent($channel, 5)) . ', ' .
       
    18                    count(stats_activity_percent($channel, 15)) . ' (respectively)';
       
    19         ?>
       
    20         </p>
       
    21     <h1>Currently active members:</h1>
       
    22     <p>These people have posted in the last 3 minutes:</p>
       
    23     <ul>
       
    24       <?php
       
    25       $datum = stats_activity_percent($channel, 3);
       
    26       $count = stats_message_count($channel, 3);
       
    27       if ( empty($datum) )
       
    28         echo '<li>No recent posts.</li>';
       
    29       foreach ( $datum as $usernick => $pct )
       
    30       {
       
    31         $total = round($pct * $count);
       
    32         $pct = round(100 * $pct, 1);
       
    33         echo "<li>$usernick - $pct% ($total)</li>\n";
       
    34       }
       
    35       ?>
       
    36     </ul>
       
    37     <p>Last 20 minutes:</p>
       
    38     <ul>
       
    39       <?php
       
    40       $datum = stats_activity_percent($channel, 20);
       
    41       $count = stats_message_count($channel, 20);
       
    42       if ( empty($datum) )
       
    43         echo '<li>No recent posts.</li>';
       
    44       foreach ( $datum as $usernick => $pct )
       
    45       {
       
    46         $total = round($pct * $count);
       
    47         $pct = round(100 * $pct, 1);
       
    48         echo "<li>$usernick - $pct% ($total)</li>\n";
       
    49       }
       
    50       ?>
       
    51     </ul>
       
    52