-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclanstats.php
More file actions
81 lines (79 loc) · 2.07 KB
/
Copy pathclanstats.php
File metadata and controls
81 lines (79 loc) · 2.07 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?
include("header.php");
$minmembers = 3;
$allusers = mysql_query("SELECT clan,networth FROM $playerdb WHERE land>0;");
$unallied = $utotal = 0;
while ($users = mysql_fetch_array($allusers))
{
if ($n = $users[clan])
{
$members[$n]++;
$totalnet[$n] += $users[networth];
$avgnet[$n] = round($totalnet[$n] / $members[$n]);
}
else $unallied++;
$utotal++;
}
if ($unallied == $utotal)
TheEnd("No clans currently exist!");
?>
<table class="inputtable">
<tr><th colspan="5">Clan Rankings - By <?
switch ($sort_type)
{
case 'members':
print "Total Members";
$sortby = $members;
break;
case 'avgnet':
print "Average Networth";
$sortby = $avgnet;
break;
case 'totalnet':
print "Total Networth";
$sortby = $totalnet;
break;
}
arsort($sortby);
reset($sortby);
while (list($key,$val) = each($sortby))
$clan[] = $key;
reset($sortby);
reset($clan);
?> (<?=$minmembers?> Member Minimum)</th></tr>
<tr><th>Clan Name</th>
<th>Tag</th>
<th><a href="<?=$config[main]?>?action=clanstats&sort_type=members">Members</a></th>
<th><a href="<?=$config[main]?>?action=clanstats&sort_type=avgnet">Average Networth</a></th>
<th><a href="<?=$config[main]?>?action=clanstats&sort_type=totalnet">Total Networth</a></th></tr>
<?
$cunlisted = $ctotal = 0;
while (list(,$num) = each($clan))
{
$uclan = loadClan($num);
if ($uclan[members] >= $minmembers)
{
?>
<tr class="acenter">
<td><?
if ($uclan[url])
print "<a href=\"$uclan[url]\" target=\"_blank\">";
print "$uclan[name]";
if ($uclan[url])
print "</a>"; ?></td>
<td><a href="<?=$config[main]?>?action=search&search_type=clan&search_clan=<?=$uclan[num]?>&do_search=1"><?=$uclan[tag]?></a></td>
<td><?=$uclan[members]?></td>
<td>$<?=commas($avgnet[$uclan[num]])?></td>
<td>$<?=commas($totalnet[$uclan[num]])?></td></tr>
<?
}
else $cunlisted++;
$ctotal++;
}
?>
</table>
<?=$cunlisted?>/<?=$ctotal?> (<?=round($cunlisted/$ctotal*100)?>%) clans don't have enough members to make this list.<br>
<?=$unallied?>/<?=$utotal?> (<?=round($unallied/$utotal*100)?>%) empires are independent.<br>
<?
TheEnd("");
?>