query("SELECT s.uuid,s.count_month,s.idle_month,u.name,u.online,u.cldgroup FROM $dbname.stats_user AS s INNER JOIN $dbname.user AS u ON s.uuid = u.uuid WHERE s.removed='0' ORDER BY (s.count_month - s.idle_month) DESC");}else{$dbdata=$mysqlcon->query("SELECT s.uuid,s.count_month,s.idle_month,u.name,u.online,u.cldgroup FROM $dbname.stats_user AS s INNER JOIN $dbname.user AS u ON s.uuid = u.uuid WHERE s.removed='0' ORDER BY s.count_month DESC");}$sumentries=$dbdata->rowCount()- 10;$db_arr=$dbdata->fetchAll();$count10=0;$top10_sum=0;$top10_idle_sum=0;foreach($db_arr as $client){$sgroups=explode(",",$client['cldgroup']);if(!in_array($client['uuid'],$exceptuuid)&&!array_intersect($sgroups,$exceptgroup)){if($count10==10)break;if($substridle==1){$hours=$client['count_month'] - $client['idle_month'];}else{$hours=$client['count_month'];}$top10_sum=round(($client['count_month']/3600))+ $top10_sum;$top10_idle_sum=round(($client['idle_month']/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");}$all_sum_data=$mysqlcon->query("SELECT SUM(count_month) FROM $dbname.stats_user");$all_sum_data_res=$all_sum_data->fetchAll();$others_sum=round(($all_sum_data_res[0][0]/3600))- $top10_sum;$all_idle_sum_data=$mysqlcon->query("SELECT SUM(idle_month) FROM $dbname.stats_user");$all_idle_sum_data_res=$all_idle_sum_data->fetchAll();$others_idle_sum=round(($all_idle_sum_data_res[0][0]/3600))- $top10_idle_sum;function get_percentage($max_value,$value){return(round(($value/$max_value)*100));}require_once('nav.php');?>
#1st
#2nd
#3rd