htdocs/index.php
changeset 11 b3fec7467c05
parent 8 0acb8d9a3194
child 15 5e2d1514ccd0
equal deleted inserted replaced
10:a97bd37e43e9 11:b3fec7467c05
    58       <?php
    58       <?php
    59       $datum = stats_activity_percent($channel, 3);
    59       $datum = stats_activity_percent($channel, 3);
    60       $count = stats_message_count($channel, 3);
    60       $count = stats_message_count($channel, 3);
    61       if ( empty($datum) )
    61       if ( empty($datum) )
    62         echo '<li>No recent posts.</li>';
    62         echo '<li>No recent posts.</li>';
    63       foreach ( $datum as $nick => $pct )
    63       foreach ( $datum as $usernick => $pct )
    64       {
    64       {
    65         $total = round($pct * $count);
    65         $total = round($pct * $count);
    66         $pct = round(100 * $pct, 1);
    66         $pct = round(100 * $pct, 1);
    67         echo "<li>$nick - $pct% ($total)</li>\n";
    67         echo "<li>$usernick - $pct% ($total)</li>\n";
    68       }
    68       }
    69       ?>
    69       ?>
    70     </ul>
    70     </ul>
    71     <p>Last 20 minutes:</p>
    71     <p>Last 20 minutes:</p>
    72     <ul>
    72     <ul>
    73       <?php
    73       <?php
    74       $datum = stats_activity_percent($channel, 20);
    74       $datum = stats_activity_percent($channel, 20);
    75       $count = stats_message_count($channel, 20);
    75       $count = stats_message_count($channel, 20);
    76       if ( empty($datum) )
    76       if ( empty($datum) )
    77         echo '<li>No recent posts.</li>';
    77         echo '<li>No recent posts.</li>';
    78       foreach ( $datum as $nick => $pct )
    78       foreach ( $datum as $usernick => $pct )
    79       {
    79       {
    80         $total = round($pct * $count);
    80         $total = round($pct * $count);
    81         $pct = round(100 * $pct, 1);
    81         $pct = round(100 * $pct, 1);
    82         echo "<li>$nick - $pct% ($total)</li>\n";
    82         echo "<li>$usernick - $pct% ($total)</li>\n";
    83       }
    83       }
    84       ?>
    84       ?>
    85     </ul>
    85     </ul>
    86     <h1>Last 24 hours</h1>
    86     <h1>Last 24 hours</h1>
    87     <img alt="Graph image" src="24hours.php?channel=<?php echo urlencode($channel); ?>" />
    87     <img alt="Graph image" src="24hours.php?channel=<?php echo urlencode($channel); ?>" />