// The contents of this file is subject to a license. // Read license.txt and readme.txt for more information. ob_start(); ?> Project JJ Chats - Statistics PHPEND; for($i=0;$i<24;$i++) { $height = ceil(200*($hours[$i]/$hours['max'])); $hours['avg'] += $hours[$i]; echo << PHPEND; } echo << PHPEND; for($i=0;$i<24;$i++) { $h = str_pad($i, 2, '0', STR_PAD_LEFT); echo <<{$h} PHPEND; } $hours['avg'] = ceil($hours['avg']/24); echo <<
PHPEND; foreach($days as $key => $day) { $height = ceil(200*($day/$dmax)); echo << PHPEND; } echo << PHPEND; foreach($days as $key => $day) { $date = substr($key, -2); echo <<{$date} PHPEND; } echo <<

$ctitle

"; $rows = mysql_query("SELECT date,h00,h01,h02,h03,h04,h05,h06,h07,h08,h09,h10,h11,h12,h13,h14,h15,h16,h17,h18,h19,h20,h21,h22,h23,(h00+h01+h02+h03+h04+h05+h06+h07+h08+h09+h10+h11+h12+h13+h14+h15+h16+h17+h18+h19+h20+h21+h22+h23) as totals FROM uo_chat_stats WHERE chat='chat{$_REQUEST['chat']}' ORDER BY date ASC", $handler); } else { echo "Overall statistics for the last 28 days

"; $rows = mysql_query("SELECT date,h00,h01,h02,h03,h04,h05,h06,h07,h08,h09,h10,h11,h12,h13,h14,h15,h16,h17,h18,h19,h20,h21,h22,h23,(h00+h01+h02+h03+h04+h05+h06+h07+h08+h09+h10+h11+h12+h13+h14+h15+h16+h17+h18+h19+h20+h21+h22+h23) as totals FROM uo_chat_stats ORDER BY date ASC", $handler); } $total = 0; $days = array(); $dmax = 1; $dmin = 99999999; $avg = 1; $hours = array(); while($row = mysql_fetch_assoc($rows)) { $days[$row['date']] += $row['totals']; $total += $row['totals']; for($i=0;$i<24;$i++) { $hours[$i] += $row['h'.str_pad($i, 2, '0', STR_PAD_LEFT)]; } } foreach($days as $day) { if ($dmax < $day) $dmax = $day; if ($dmin > $day) $dmin = $day; } $avg = ceil($total/28); $hours['max'] = 1; $hours['min'] = 99999999; for($i=0;$i<24;$i++) { $hours[$i] = ceil($hours[$i]/28); if ($hours['max'] < $hours[$i]) $hours['max'] = $hours[$i]; if ($hours['min'] > $hours[$i]) $hours['min'] = $hours[$i]; } echo <<

Daily Usage
Max: {$dmax} / Min: {$dmin} / Avg: {$avg}

PHPEND; $tz = date('T'); echo <<
Hourly Usage ({$tz} Timezone)
Max: {$hours['max']} / Min: {$hours['min']} / Avg: {$hours['avg']}
PHPEND; ?>