query("SELECT uuid,name,count,idle,cldgroup,online FROM $dbname.user ORDER BY (count - idle) DESC")->fetchAll(PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC); $texttime = $lang['sttw0013']; } else { $db_arr = $mysqlcon->query("SELECT uuid,name,count,idle,cldgroup,online FROM $dbname.user ORDER BY count DESC")->fetchAll(PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC); $texttime = $lang['sttw0003']; } $sumentries = count($db_arr) - 10; $count10 = 0; $top10_sum = 0; $top10_idle_sum = 0; foreach ($db_arr as $uuid => $client) { $sgroups = array_flip(explode(",", $client['cldgroup'])); if (!isset($exceptuuid[$uuid]) && !array_intersect_key($sgroups, $exceptgroup)) { if ($count10 == 10) break; if ($substridle == 1) { $hours = $client['count'] - $client['idle']; } else { $hours = $client['count']; } $top10_sum = round(($client['count']/3600)) + $top10_sum; $top10_idle_sum = round(($client['idle']/3600)) + $top10_idle_sum; $client_data[$count10] = array( 'name' => $client['name'], 'count' => $hours, 'online' => $client['online'] ); $count10++; } } for($count10 = $count10; $count10 <= 10; $count10++) { $client_data[$count10] = array( 'name' => "unkown", 'count' => "0", 'online' => "0" ); } $sum = $mysqlcon->query("SELECT SUM(count) AS count, SUM(idle) AS idle FROM $dbname.user")->fetch(); $others_sum = round(($sum['count']/3600)) - $top10_sum; $others_idle_sum = round(($sum['idle']/3600)) - $top10_idle_sum; function get_percentage($max_value, $value) { return (round(($value/$max_value)*100)); } require_once('nav.php'); ?>
#1st
#2nd
#3rd