-
Notifications
You must be signed in to change notification settings - Fork 3
/
stats_global.php
244 lines (230 loc) · 12.2 KB
/
stats_global.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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php include 'components/authentication.php' ?>
<?php include 'components/session-check.php' ?>
<?php include 'controllers/base/head.php' ?>
<?php include 'controllers/navigation/first-navigation.php' ?>
<?php
include '_database/database.php';
$sql = "SELECT * FROM war_table LIMIT 1";
$result = mysqli_query($database,$sql) or die(mysqli_error($database));
while($rws = mysqli_fetch_array($result)){
?>
<div class="container">
<h1 class="text-center profile-name" style="margin-top:35;"><?php echo $clananame;?><small><br />Statistics</small></h1><br />
<div class="text-right"><a href="javascript:history.go(-1)" class="btn btn-success" onMouseOver="self.status=document.referrer;return true">back</a> </div>
<!-- start statistic page -->
<div class="col-md-12 panel">
<div class="col-md-12" style=" padding-top:20;">
<label>Attack Styles</label>
<hr />
<div class="col-md-3" style="padding:20;">
<label>3 stars</label>
<?php
function porcent_attack($troop, $string_troop){
include '_database/database.php';
$sql = "SELECT favattack, count(*) as 'Cnt' FROM score WHERE favattack='$troop' GROUP BY favattack";
$result = mysqli_query($database,$sql) or die(mysqli_error($database));
while($rws = mysqli_fetch_array($result)){
$sql2 = "SELECT favattack, count(*) as 'Cnt2' FROM score WHERE favattack='$troop' AND Score=3 GROUP BY favattack";
$result2 = mysqli_query($database,$sql2) or die(mysqli_error($database));
while($rws2 = mysqli_fetch_array($result2)){
$x = $rws['Cnt'];
$y = $rws2['Cnt2'];
$porcent = ($y * 100) / $x;
$format = number_format($porcent, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<strong><?php echo $string_troop;?></strong> <span class="badge" style="background-color:#090;"><?php echo $format;?> %</span></a><br />
<?php echo $rws['Cnt'];?> - Attacks, <?php echo $rws2['Cnt2'];?> - 3 <span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><br />
</div>
<?php } } }?>
<?php porcent_attack('goho','Goho');?>
<?php porcent_attack('gohoc','Goho Sha');?>
<?php porcent_attack('golalo','Golalon');?>
<?php porcent_attack('gowipe','Gowipe');?>
<?php porcent_attack('gowiwi','Gowiwi');?>
<?php porcent_attack('lalonion','Lalonion');?>
<?php porcent_attack('dragons','Dragons');?>
<?php porcent_attack('other','Others');?>
</div>
<div class="col-md-3" style="padding:20;">
<label>2 star</label>
<?php
function porcent_attack4($troop, $string_troop){
include '_database/database.php';
$sql3 = "SELECT favattack, count(*) as 'Cnt3' FROM score WHERE favattack='$troop' GROUP BY favattack";
$result3 = mysqli_query($database,$sql3) or die(mysqli_error($database));
while($rws3 = mysqli_fetch_array($result3)){
$sql4 = "SELECT favattack, count(*) as 'Cnt4' FROM score WHERE favattack='$troop' AND Score =2 GROUP BY favattack";
$result4 = mysqli_query($database,$sql4) or die(mysqli_error($database));
while($rws4 = mysqli_fetch_array($result4)){
$x2 = $rws3['Cnt3'];
$y2 = $rws4['Cnt4'];
$porcent = ($y2 * 100) / $x2;
$format = number_format($porcent, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<strong><?php echo $string_troop;?></strong> <span class="badge" style="background-color:#A9C120;">-<?php echo $format;?> %</span></a><br />
<?php echo $rws3['Cnt3'];?> - Attacks, <?php echo $rws4['Cnt4'];?> - 2 <span class="fa fa-star"></span><span class="fa fa-star"></span><br />
</div>
<?php } } }?>
<?php porcent_attack4('goho','Goho');?>
<?php porcent_attack4('gohoc','Goho Sha');?>
<?php porcent_attack4('golalo','Golalon');?>
<?php porcent_attack4('gowipe','Gowipe');?>
<?php porcent_attack4('gowiwi','Gowiwi');?>
<?php porcent_attack4('lalonion','Lalonion');?>
<?php porcent_attack4('dragons','Dragons');?>
<?php porcent_attack4('other','Others');?>
</div>
<div class="col-md-3" style="padding:20;">
<label>1 star</label>
<?php
function porcent_attack3($troop, $string_troop){
include '_database/database.php';
$sql3 = "SELECT favattack, count(*) as 'Cnt3' FROM score WHERE favattack='$troop' GROUP BY favattack";
$result3 = mysqli_query($database,$sql3) or die(mysqli_error($database));
while($rws3 = mysqli_fetch_array($result3)){
$sql4 = "SELECT favattack, count(*) as 'Cnt4' FROM score WHERE favattack='$troop' AND Score =1 GROUP BY favattack";
$result4 = mysqli_query($database,$sql4) or die(mysqli_error($database));
while($rws4 = mysqli_fetch_array($result4)){
$x2 = $rws3['Cnt3'];
$y2 = $rws4['Cnt4'];
$porcent = ($y2 * 100) / $x2;
$format = number_format($porcent, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<strong><?php echo $string_troop;?></strong> <span class="badge" style="background-color:orange;">-<?php echo $format;?> %</span></a><br />
<?php echo $rws3['Cnt3'];?> - Attacks, <?php echo $rws4['Cnt4'];?> - 1 <span class="fa fa-star"></span><br />
</div>
<?php } } }?>
<?php porcent_attack3('goho','Goho');?>
<?php porcent_attack3('gohoc','Goho Sha');?>
<?php porcent_attack3('golalo','Golalon');?>
<?php porcent_attack3('gowipe','Gowipe');?>
<?php porcent_attack3('gowiwi','Gowiwi');?>
<?php porcent_attack3('lalonion','Lalonion');?>
<?php porcent_attack3('dragons','Dragons');?>
<?php porcent_attack3('other','Others');?>
</div>
<div class="col-md-3" style="padding:20;">
<label>Fails</label>
<?php
function porcent_attack2($troop, $string_troop){
include '_database/database.php';
$sql3 = "SELECT favattack, count(*) as 'Cnt3' FROM score WHERE favattack='$troop' GROUP BY favattack";
$result3 = mysqli_query($database,$sql3) or die(mysqli_error($database));
while($rws3 = mysqli_fetch_array($result3)){
$sql4 = "SELECT favattack, count(*) as 'Cnt4' FROM score WHERE favattack='$troop' AND Score =0 GROUP BY favattack";
$result4 = mysqli_query($database,$sql4) or die(mysqli_error($database));
while($rws4 = mysqli_fetch_array($result4)){
$x2 = $rws3['Cnt3'];
$y2 = $rws4['Cnt4'];
$porcent = ($y2 * 100) / $x2;
$format = number_format($porcent, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<strong><?php echo $string_troop;?></strong> <span class="badge" style="background-color:red;">-<?php echo $format;?> %</span></a><br />
<?php echo $rws3['Cnt3'];?> - Attacks, <?php echo $rws4['Cnt4'];?> - Fail<br />
</div>
<?php } } }?>
<?php porcent_attack2('goho','Goho');?>
<?php porcent_attack2('gohoc','Goho Sha');?>
<?php porcent_attack2('golalo','Golalon');?>
<?php porcent_attack2('gowipe','Gowipe');?>
<?php porcent_attack2('gowiwi','Gowiwi');?>
<?php porcent_attack2('lalonion','Lalonion');?>
<?php porcent_attack2('dragons','Dragons');?>
<?php porcent_attack2('other','Others');?>
</div>
<div class="row"></div>
<label>Members Porcentage</label>
<hr />
<div class="col-md-3" style="padding:20;">
<label>3 Stars</label>
<?php
$members_sql = "SELECT user_username, count(*) as 'memcount' FROM score GROUP BY user_username ORDER BY user_username ASC";
$result_members = mysqli_query($database,$members_sql) or die(mysqli_error($database));
while($mem = mysqli_fetch_array($result_members)){
$member = $mem['user_username'];
$members_sql2 = "SELECT user_username, count(*) as 'memcount2' FROM score WHERE user_username='$member' AND Score = 3 GROUP BY user_username ";
$result_members2 = mysqli_query($database,$members_sql2) or die(mysqli_error($database));
while($mem2 = mysqli_fetch_array($result_members2)){
$a = $mem['memcount'];
$b = $mem2['memcount2'];
$porcent_mem = ($b * 100) / $a;
$format = number_format($porcent_mem, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<a href="profile.php?user_username=<?php echo $mem['user_username'];?>" class="list-group-item"> <strong><?php echo $mem['user_username'];?></strong> <span class="badge" style="background-color:#090;"><?php echo $format;?> %</span><br />
<?php echo $mem['memcount'];?> - Attacks, <?php echo $mem2['memcount2'];?> - 3 <span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><br /></a>
</div>
<?php } }?>
</div>
<div class="col-md-3" style="padding:20;">
<label>2 stars</label>
<?php
$members_sql = "SELECT user_username, count(*) as 'memcount' FROM score GROUP BY user_username ORDER BY user_username ASC";
$result_members = mysqli_query($database,$members_sql) or die(mysqli_error($database));
while($mem = mysqli_fetch_array($result_members)){
$member = $mem['user_username'];
$members_sql2 = "SELECT user_username, count(*) as 'memcount2' FROM score WHERE user_username='$member' AND Score = 2 GROUP BY user_username";
$result_members2 = mysqli_query($database,$members_sql2) or die(mysqli_error($database));
while($mem2 = mysqli_fetch_array($result_members2)){
$a = $mem['memcount'];
$b = $mem2['memcount2'];
$porcent_mem = ($b * 100) / $a;
$format = number_format($porcent_mem, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<a href="profile.php?user_username=<?php echo $mem['user_username'];?>" class="list-group-item"><strong><?php echo $mem['user_username'];?></strong> <span class="badge" style="background-color:#A9C120;"><?php echo $format;?> %</span><br />
<?php echo $mem['memcount'];?> - Attacks, <?php echo $mem2['memcount2'];?> - 2 <span class="fa fa-star"></span><span class="fa fa-star"></span></span><br /></a>
</div>
<?php } }?>
</div>
<div class="col-md-3" style="padding:20;">
<label>1 Star</label>
<?php
$members_sql = "SELECT user_username, count(*) as 'memcount' FROM score GROUP BY user_username ORDER BY user_username ASC";
$result_members = mysqli_query($database,$members_sql) or die(mysqli_error($database));
while($mem = mysqli_fetch_array($result_members)){
$member = $mem['user_username'];
$members_sql2 = "SELECT user_username, count(*) as 'memcount2' FROM score WHERE user_username='$member' AND Score = 1 GROUP BY user_username";
$result_members2 = mysqli_query($database,$members_sql2) or die(mysqli_error($database));
while($mem2 = mysqli_fetch_array($result_members2)){
$a = $mem['memcount'];
$b = $mem2['memcount2'];
$porcent_mem = ($b * 100) / $a;
$format = number_format($porcent_mem, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<a href="profile.php?user_username=<?php echo $mem['user_username'];?>" class="list-group-item"><strong><?php echo $mem['user_username'];?></strong> <span class="badge" style="background-color:orange;"><?php echo $format;?> %</span><br />
<?php echo $mem['memcount'];?> - Attacks, <?php echo $mem2['memcount2'];?> - 1 <span class="fa fa-star"></span></span><br /></a>
</div>
<?php } }?>
</div>
<div class="col-md-3" style="padding:20;">
<label>Fails</label>
<?php
$members_sql = "SELECT user_username, count(*) as 'memcount' FROM score GROUP BY user_username ORDER BY user_username ASC";
$result_members = mysqli_query($database,$members_sql) or die(mysqli_error($database));
while($mem = mysqli_fetch_array($result_members)){
$member = $mem['user_username'];
$members_sql2 = "SELECT user_username, count(*) as 'memcount2' FROM score WHERE user_username='$member' AND Score = 0 GROUP BY user_username";
$result_members2 = mysqli_query($database,$members_sql2) or die(mysqli_error($database));
while($mem2 = mysqli_fetch_array($result_members2)){
$a = $mem['memcount'];
$b = $mem2['memcount2'];
$porcent_mem = ($b * 100) / $a;
$format = number_format($porcent_mem, 2, '.', '');
?>
<div style="border:solid #999 1px;; padding:3px;">
<a href="profile.php?user_username=<?php echo $mem['user_username'];?>" class="list-group-item"> <strong><?php echo $mem['user_username'];?></strong> <span class="badge" style="background-color:red;"><?php echo $format;?> %</span><br />
<?php echo $mem['memcount'];?> - Attacks, <?php echo $mem2['memcount2'];?> - Fail</span><br /></a>
</div>
<?php } }?>
</div>
</div>
</div>
<!-- end statistic page-->
</div>
<?php }?>