forked from thijsdezoete/OpenArena-Stats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapcounts.php
35 lines (31 loc) · 852 Bytes
/
mapcounts.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$s = microtime(true);
ini_set('display_errors', 'on');
$dir = dir('games');
while($entry = $dir->read()) {
if(substr($entry,0,1) != '.') {
include('games/'.$entry);
$game = array_pop($games);
if(@$game['voted'] == true) {
isset($votedmaps[$game['map']]) ? $votedmaps[$game['map']]++ : $votedmaps[$game['map']]=1;
} else {
isset($playedmaps[$game['map']]) ? $playedmaps[$game['map']]++ : $playedmaps[$game['map']]=1;
}
}
}
$votedSum=0;$playedSum=0;
echo "Voted:\n";
arsort($votedmaps);
foreach($votedmaps as $map => $count) {
echo $map.' - '.$count."\n";
$votedSum+=$count;
}
echo "\nPlayed:\n";
arsort($playedmaps);
foreach($playedmaps as $map => $count) {
echo $map.' - '.$count."\n";
$playedSum+=$count;
}
echo "Total played: $playedSum, Total voted: $votedSum\n";
$e = microtime(true);
echo "Time :".($e-$s)."\n";