just a quick uncomment cause some just run and wonder why it dose nothing
[travianx.git] / medals.php
blob0b3505b483828420639c5e10b9965749c0bd0a0a
1 <?php
3 #################################################################################
4 ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
5 ## --------------------------------------------------------------------------- ##
6 ## Filename medals.php ##
7 ## Developed by: Dixie ##
8 ## License: TravianX Project ##
9 ## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
10 ## ##
11 #################################################################################
13 /******************************
14 INDELING CATEGORIEEN:
15 ===============================
16 == 1. Aanvallers top 10 ==
17 == 2. Defence top 10 ==
18 == 3. Klimmers top 10 ==
19 == 4. Overvallers top 10 ==
20 == 5. In att en def tegelijk ==
21 == 6. in top 3 - aanval ==
22 == 7. in top 3 - verdediging ==
23 == 8. in top 3 - klimmers ==
24 == 9. in top 3 - overval ==
25 ******************************/
26 include_once("GameEngine/Account.php");
28 mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
29 mysql_select_db(SQL_DB);
31 if (mysql_num_rows(mysql_query("SELECT id FROM ".TB_PREFIX."users WHERE access = 9 AND id = ".$session->uid)) != '1') die("Hacking attemp!");
33 //bepaal welke week we zitten
34 $q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
35 $result = mysql_query($q);
36 if(mysql_num_rows($result)) {
37 $row=mysql_fetch_assoc($result);
38 $week=($row['week']+1);
39 } else {
40 $week='1';
43 //Do same for ally week
44 $q = "SELECT * FROM ".TB_PREFIX."allimedal order by week DESC LIMIT 0, 1";
45 $result = mysql_query($q);
46 if(mysql_num_rows($result)) {
47 $row=mysql_fetch_assoc($result);
48 $allyweek=($row['week']+1);
49 } else {
50 $allyweek='1';
53 //we mogen de lintjes weggeven
54 if(isset($_GET['giveout'])){
57 //Aanvallers v/d Week
58 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC Limit 10");
59 $i=0; while($row = mysql_fetch_array($result)){
60 $i++; $img="t2_".($i)."";
61 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '1', '".($i)."', '".$week."', '".$row['ap']."', '".$img."')";
62 $resul=mysql_query($quer);
65 //Verdediger v/d Week
66 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC Limit 10");
67 $i=0; while($row = mysql_fetch_array($result)){
68 $i++; $img="t3_".($i)."";
69 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '2', '".($i)."', '".$week."', '".$row['dp']."', '".$img."')";
70 $resul=mysql_query($quer);
73 //Klimmers v/d Week
74 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC Limit 10");
75 $i=0; while($row = mysql_fetch_array($result)){
76 $i++; $img="t1_".($i)."";
77 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '3', '".($i)."', '".$week."', '".$row['Rc']."', '".$img."')";
78 $resul=mysql_query($quer);
81 //Rank climbers of the week
82 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC Limit 10");
83 $i=0; while($row = mysql_fetch_array($result)){
84 $i++; $img="t6_".($i)."";
85 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '10', '".($i)."', '".$week."', '".$row['clp']."', '".$img."')";
86 $resul=mysql_query($quer);
89 //Overvallers v/d Week
90 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC Limit 10");
91 $i=0; while($row = mysql_fetch_array($result)){
92 $i++; $img="t4_".($i)."";
93 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '4', '".($i)."', '".$week."', '".$row['RR']."', '".$img."')";
94 $resul=mysql_query($quer);
97 //deel de bonus voor aanval+defence top 10 uit
98 //Pak de top10 aanvallers
99 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC Limit 10");
100 while($row = mysql_fetch_array($result)){
102 //Pak de top10 verdedigers
103 $result2 = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC Limit 10");
104 while($row2 = mysql_fetch_array($result2)){
105 if($row['id']==$row2['id']){
107 $query3="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 5";
108 $result3=mysql_query($query3);
109 $row3=mysql_fetch_row($result3);
111 //kijk welke kleur het lintje moet hebben
112 if($row3[0]<='2'){
113 $img="t22".$row3[0]."_1";
114 switch ($row3[0]) {
115 case "0":
116 $tekst="";
117 break;
118 case "1":
119 $tekst="twice ";
120 break;
121 case "2":
122 $tekst="three times ";
123 break;
125 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '5', '0', '".$week."', '".$tekst."', '".$img."')";
126 $resul=mysql_query($quer);
132 //je staat voor 3e / 5e / 10e keer in de top 3 aanvallers
133 //Pak de top10 aanvallers
134 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC Limit 10");
135 while($row = mysql_fetch_array($result)){
137 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 1 AND plaats<=3";
138 $result1=mysql_query($query1);
139 $row1=mysql_fetch_row($result1);
142 //2x in gestaan, dit is 3e dus lintje (brons)
143 if($row1[0]=='3'){
144 $img="t120_1";
145 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$week."', 'Three', '".$img."')";
146 $resul=mysql_query($quer);
148 //4x in gestaan, dit is 5e dus lintje (zilver)
149 if($row1[0]=='5'){
150 $img="t121_1";
151 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$week."', 'Five', '".$img."')";
152 $resul=mysql_query($quer);
154 //9x in gestaan, dit is 10e dus lintje (goud)
155 if($row1[0]=='10'){
156 $img="t122_1";
157 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$week."', 'Ten', '".$img."')";
158 $resul=mysql_query($quer);
162 //je staat voor 3e / 5e / 10e keer in de top 10 aanvallers
163 //Pak de top10 aanvallers
164 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC Limit 10");
165 while($row = mysql_fetch_array($result)){
167 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 1 AND plaats<=10";
168 $result1=mysql_query($query1);
169 $row1=mysql_fetch_row($result1);
172 //2x in gestaan, dit is 3e dus lintje (brons)
173 if($row1[0]=='3'){
174 $img="t130_1";
175 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$week."', 'Three', '".$img."')";
176 $resul=mysql_query($quer);
178 //4x in gestaan, dit is 5e dus lintje (zilver)
179 if($row1[0]=='5'){
180 $img="t131_1";
181 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$week."', 'Five', '".$img."')";
182 $resul=mysql_query($quer);
184 //9x in gestaan, dit is 10e dus lintje (goud)
185 if($row1[0]=='10'){
186 $img="t132_1";
187 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$week."', 'Ten', '".$img."')";
188 $resul=mysql_query($quer);
192 //je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
193 //Pak de top10 verdedigers
194 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC Limit 10");
195 while($row = mysql_fetch_array($result)){
197 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 2 AND plaats<=3";
198 $result1=mysql_query($query1);
199 $row1=mysql_fetch_row($result1);
202 //2x in gestaan, dit is 3e dus lintje (brons)
203 if($row1[0]=='3'){
204 $img="t140_1";
205 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$week."', 'Three', '".$img."')";
206 $resul=mysql_query($quer);
208 //4x in gestaan, dit is 5e dus lintje (zilver)
209 if($row1[0]=='5'){
210 $img="t141_1";
211 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$week."', 'Five', '".$img."')";
212 $resul=mysql_query($quer);
214 //9x in gestaan, dit is 10e dus lintje (goud)
215 if($row1[0]=='10'){
216 $img="t142_1";
217 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$week."', 'Ten', '".$img."')";
218 $resul=mysql_query($quer);
222 //je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
223 //Pak de top10 verdedigers
224 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC Limit 10");
225 while($row = mysql_fetch_array($result)){
227 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 2 AND plaats<=10";
228 $result1=mysql_query($query1);
229 $row1=mysql_fetch_row($result1);
232 //2x in gestaan, dit is 3e dus lintje (brons)
233 if($row1[0]=='3'){
234 $img="t150_1";
235 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$week."', 'Three', '".$img."')";
236 $resul=mysql_query($quer);
238 //4x in gestaan, dit is 5e dus lintje (zilver)
239 if($row1[0]=='5'){
240 $img="t151_1";
241 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$week."', 'Five', '".$img."')";
242 $resul=mysql_query($quer);
244 //9x in gestaan, dit is 10e dus lintje (goud)
245 if($row1[0]=='10'){
246 $img="t152_1";
247 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$week."', 'Ten', '".$img."')";
248 $resul=mysql_query($quer);
253 //je staat voor 3e / 5e / 10e keer in de top 3 klimmers
254 //Pak de top10 klimmers
255 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC Limit 10");
256 while($row = mysql_fetch_array($result)){
258 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 3 AND plaats<=3";
259 $result1=mysql_query($query1);
260 $row1=mysql_fetch_row($result1);
263 //2x in gestaan, dit is 3e dus lintje (brons)
264 if($row1[0]=='3'){
265 $img="t100_1";
266 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$week."', 'Three', '".$img."')";
267 $resul=mysql_query($quer);
269 //4x in gestaan, dit is 5e dus lintje (zilver)
270 if($row1[0]=='5'){
271 $img="t101_1";
272 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$week."', 'Five', '".$img."')";
273 $resul=mysql_query($quer);
275 //9x in gestaan, dit is 10e dus lintje (goud)
276 if($row1[0]=='10'){
277 $img="t102_1";
278 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$week."', 'Ten', '".$img."')";
279 $resul=mysql_query($quer);
281 }//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
282 //Pak de top10 klimmers
283 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC Limit 10");
284 while($row = mysql_fetch_array($result)){
286 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 3 AND plaats<=10";
287 $result1=mysql_query($query1);
288 $row1=mysql_fetch_row($result1);
291 //2x in gestaan, dit is 3e dus lintje (brons)
292 if($row1[0]=='3'){
293 $img="t110_1";
294 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '14', '0', '".$week."', 'Three', '".$img."')";
295 $resul=mysql_query($quer);
297 //4x in gestaan, dit is 5e dus lintje (zilver)
298 if($row1[0]=='5'){
299 $img="t111_1";
300 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '14', '0', '".$week."', 'Five', '".$img."')";
301 $resul=mysql_query($quer);
303 //9x in gestaan, dit is 10e dus lintje (goud)
304 if($row1[0]=='10'){
305 $img="t112_1";
306 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '14', '0', '".$week."', 'Ten', '".$img."')";
307 $resul=mysql_query($quer);
311 //je staat voor 3e / 5e / 10e keer in de top 3 klimmers
312 //Pak de top3 rank climbers
313 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC Limit 10");
314 while($row = mysql_fetch_array($result)){
316 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 10 AND plaats<=3";
317 $result1=mysql_query($query1);
318 $row1=mysql_fetch_row($result1);
321 //2x in gestaan, dit is 3e dus lintje (brons)
322 if($row1[0]=='3'){
323 $img="t200_1";
324 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '11', '0', '".$week."', 'Three', '".$img."')";
325 $resul=mysql_query($quer);
327 //4x in gestaan, dit is 5e dus lintje (zilver)
328 if($row1[0]=='5'){
329 $img="t201_1";
330 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '11', '0', '".$week."', 'Five', '".$img."')";
331 $resul=mysql_query($quer);
333 //9x in gestaan, dit is 10e dus lintje (goud)
334 if($row1[0]=='10'){
335 $img="t202_1";
336 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '11', '0', '".$week."', 'Ten', '".$img."')";
337 $resul=mysql_query($quer);
340 //je staat voor 3e / 5e / 10e keer in de top 10klimmers
341 //Pak de top3 rank climbers
342 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC Limit 10");
343 while($row = mysql_fetch_array($result)){
345 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 10 AND plaats<=10";
346 $result1=mysql_query($query1);
347 $row1=mysql_fetch_row($result1);
350 //2x in gestaan, dit is 3e dus lintje (brons)
351 if($row1[0]=='3'){
352 $img="t210_1";
353 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$week."', 'Three', '".$img."')";
354 $resul=mysql_query($quer);
356 //4x in gestaan, dit is 5e dus lintje (zilver)
357 if($row1[0]=='5'){
358 $img="t211_1";
359 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$week."', 'Five', '".$img."')";
360 $resul=mysql_query($quer);
362 //9x in gestaan, dit is 10e dus lintje (goud)
363 if($row1[0]=='10'){
364 $img="t212_1";
365 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$week."', 'Ten', '".$img."')";
366 $resul=mysql_query($quer);
370 //je staat voor 3e / 5e / 10e keer in de top 10 overvallers
371 //Pak de top10 overvallers
372 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC Limit 10");
373 while($row = mysql_fetch_array($result)){
375 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 4 AND plaats<=3";
376 $result1=mysql_query($query1);
377 $row1=mysql_fetch_row($result1);
380 //2x in gestaan, dit is 3e dus lintje (brons)
381 if($row1[0]=='3'){
382 $img="t160_1";
383 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$week."', 'Three', '".$img."')";
384 $resul=mysql_query($quer);
386 //4x in gestaan, dit is 5e dus lintje (zilver)
387 if($row1[0]=='5'){
388 $img="t161_1";
389 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$week."', 'Five', '".$img."')";
390 $resul=mysql_query($quer);
392 //9x in gestaan, dit is 10e dus lintje (goud)
393 if($row1[0]=='10'){
394 $img="t162_1";
395 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$week."', 'Ten', '".$img."')";
396 $resul=mysql_query($quer);
398 } //je staat voor 3e / 5e / 10e keer in de top 10 overvallers
399 //Pak de top10 overvallers
400 $result = mysql_query("SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC Limit 10");
401 while($row = mysql_fetch_array($result)){
403 $query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid='".$row['id']."' AND categorie = 4 AND plaats<=10";
404 $result1=mysql_query($query1);
405 $row1=mysql_fetch_row($result1);
408 //2x in gestaan, dit is 3e dus lintje (brons)
409 if($row1[0]=='3'){
410 $img="t170_1";
411 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$week."', 'Three', '".$img."')";
412 $resul=mysql_query($quer);
414 //4x in gestaan, dit is 5e dus lintje (zilver)
415 if($row1[0]=='5'){
416 $img="t171_1";
417 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$week."', 'Five', '".$img."')";
418 $resul=mysql_query($quer);
420 //9x in gestaan, dit is 10e dus lintje (goud)
421 if($row1[0]=='10'){
422 $img="t172_1";
423 $quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$week."', 'Ten', '".$img."')";
424 $resul=mysql_query($quer);
428 //Zet alle waardens weer op 0
429 $query="SELECT * FROM ".TB_PREFIX."users ORDER BY id+0 DESC";
430 $result=mysql_query($query);
431 for ($i=0; $row=mysql_fetch_row($result); $i++){
432 mysql_query("UPDATE ".TB_PREFIX."users SET ap=0, dp=0,Rc=0,clp=0, RR=0 WHERE id = ".$row[0]."");
435 //Start alliance Medals wooot
437 //Aanvallers v/d Week
438 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC Limit 10");
439 $i=0; while($row = mysql_fetch_array($result)){
440 $i++; $img="a2_".($i)."";
441 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '1', '".($i)."', '".$allyweek."', '".$row['ap']."', '".$img."')";
442 $resul=mysql_query($quer);
445 //Verdediger v/d Week
446 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
447 $i=0; while($row = mysql_fetch_array($result)){
448 $i++; $img="a3_".($i)."";
449 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '2', '".($i)."', '".$allyweek."', '".$row['dp']."', '".$img."')";
450 $resul=mysql_query($quer);
453 //Overvallers v/d Week
454 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY RR DESC Limit 10");
455 $i=0; while($row = mysql_fetch_array($result)){
456 $i++; $img="a4_".($i)."";
457 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '4', '".($i)."', '".$allyweek."', '".$row['RR']."', '".$img."')";
458 $resul=mysql_query($quer);
460 //Rank climbers of the week
461 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
462 $i=0; while($row = mysql_fetch_array($result)){
463 $i++; $img="a1_".($i)."";
464 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '3', '".($i)."', '".$allyweek."', '".$row['clp']."', '".$img."')";
465 $resul=mysql_query($quer);
468 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC Limit 10");
469 while($row = mysql_fetch_array($result)){
471 //Pak de top10 verdedigers
472 $result2 = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
473 while($row2 = mysql_fetch_array($result2)){
474 if($row['id']==$row2['id']){
476 $query3="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 5";
477 $result3=mysql_query($query3);
478 $row3=mysql_fetch_row($result3);
480 //kijk welke kleur het lintje moet hebben
481 if($row3[0]<='2'){
482 $img="t22".$row3[0]."_1";
483 switch ($row3[0]) {
484 case "0":
485 $tekst="";
486 break;
487 case "1":
488 $tekst="twice ";
489 break;
490 case "2":
491 $tekst="three times ";
492 break;
494 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '5', '0', '".$allyweek."', '".$tekst."', '".$img."')";
495 $resul=mysql_query($quer);
501 //je staat voor 3e / 5e / 10e keer in de top 3 aanvallers
502 //Pak de top10 aanvallers
503 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC Limit 10");
504 while($row = mysql_fetch_array($result)){
506 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 1 AND plaats<=3";
507 $result1=mysql_query($query1);
508 $row1=mysql_fetch_row($result1);
511 //2x in gestaan, dit is 3e dus lintje (brons)
512 if($row1[0]=='3'){
513 $img="t120_1";
514 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$allyweek."', 'Three', '".$img."')";
515 $resul=mysql_query($quer);
517 //4x in gestaan, dit is 5e dus lintje (zilver)
518 if($row1[0]=='5'){
519 $img="t121_1";
520 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$allyweek."', 'Five', '".$img."')";
521 $resul=mysql_query($quer);
523 //9x in gestaan, dit is 10e dus lintje (goud)
524 if($row1[0]=='10'){
525 $img="t122_1";
526 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '6', '0', '".$allyweek."', 'Ten', '".$img."')";
527 $resul=mysql_query($quer);
531 //je staat voor 3e / 5e / 10e keer in de top 10 aanvallers
532 //Pak de top10 aanvallers
533 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC Limit 10");
534 while($row = mysql_fetch_array($result)){
536 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 1 AND plaats<=10";
537 $result1=mysql_query($query1);
538 $row1=mysql_fetch_row($result1);
541 //2x in gestaan, dit is 3e dus lintje (brons)
542 if($row1[0]=='3'){
543 $img="t130_1";
544 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$allyweek."', 'Three', '".$img."')";
545 $resul=mysql_query($quer);
547 //4x in gestaan, dit is 5e dus lintje (zilver)
548 if($row1[0]=='5'){
549 $img="t131_1";
550 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$allyweek."', 'Five', '".$img."')";
551 $resul=mysql_query($quer);
553 //9x in gestaan, dit is 10e dus lintje (goud)
554 if($row1[0]=='10'){
555 $img="t132_1";
556 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '12', '0', '".$allyweek."', 'Ten', '".$img."')";
557 $resul=mysql_query($quer);
561 //je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
562 //Pak de top10 verdedigers
563 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
564 while($row = mysql_fetch_array($result)){
566 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 2 AND plaats<=3";
567 $result1=mysql_query($query1);
568 $row1=mysql_fetch_row($result1);
571 //2x in gestaan, dit is 3e dus lintje (brons)
572 if($row1[0]=='3'){
573 $img="t140_1";
574 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$allyweek."', 'Three', '".$img."')";
575 $resul=mysql_query($quer);
577 //4x in gestaan, dit is 5e dus lintje (zilver)
578 if($row1[0]=='5'){
579 $img="t141_1";
580 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$allyweek."', 'Five', '".$img."')";
581 $resul=mysql_query($quer);
583 //9x in gestaan, dit is 10e dus lintje (goud)
584 if($row1[0]=='10'){
585 $img="t142_1";
586 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '7', '0', '".$allyweek."', 'Ten', '".$img."')";
587 $resul=mysql_query($quer);
591 //je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
592 //Pak de top10 verdedigers
593 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
594 while($row = mysql_fetch_array($result)){
596 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 2 AND plaats<=10";
597 $result1=mysql_query($query1);
598 $row1=mysql_fetch_row($result1);
601 //2x in gestaan, dit is 3e dus lintje (brons)
602 if($row1[0]=='3'){
603 $img="t150_1";
604 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$allyweek."', 'Three', '".$img."')";
605 $resul=mysql_query($quer);
607 //4x in gestaan, dit is 5e dus lintje (zilver)
608 if($row1[0]=='5'){
609 $img="t151_1";
610 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$allyweek."', 'Five', '".$img."')";
611 $resul=mysql_query($quer);
613 //9x in gestaan, dit is 10e dus lintje (goud)
614 if($row1[0]=='10'){
615 $img="t152_1";
616 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '13', '0', '".$allyweek."', 'Ten', '".$img."')";
617 $resul=mysql_query($quer);
624 //je staat voor 3e / 5e / 10e keer in de top 3 klimmers
625 //Pak de top3 rank climbers
626 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
627 while($row = mysql_fetch_array($result)){
629 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 10 AND plaats<=3";
630 $result1=mysql_query($query1);
631 $row1=mysql_fetch_row($result1);
634 //2x in gestaan, dit is 3e dus lintje (brons)
635 if($row1[0]=='3'){
636 $img="t100_1";
637 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$allyweek."', 'Three', '".$img."')";
638 $resul=mysql_query($quer);
640 //4x in gestaan, dit is 5e dus lintje (zilver)
641 if($row1[0]=='5'){
642 $img="t101_1";
643 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$allyweek."', 'Five', '".$img."')";
644 $resul=mysql_query($quer);
646 //9x in gestaan, dit is 10e dus lintje (goud)
647 if($row1[0]=='10'){
648 $img="t102_1";
649 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '8', '0', '".$allyweek."', 'Ten', '".$img."')";
650 $resul=mysql_query($quer);
653 //je staat voor 3e / 5e / 10e keer in de top 10klimmers
654 //Pak de top3 rank climbers
655 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
656 while($row = mysql_fetch_array($result)){
658 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 10 AND plaats<=10";
659 $result1=mysql_query($query1);
660 $row1=mysql_fetch_row($result1);
663 //2x in gestaan, dit is 3e dus lintje (brons)
664 if($row1[0]=='3'){
665 $img="t110_1";
666 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$allyweek."', 'Three', '".$img."')";
667 $resul=mysql_query($quer);
669 //4x in gestaan, dit is 5e dus lintje (zilver)
670 if($row1[0]=='5'){
671 $img="t111_1";
672 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$allyweek."', 'Five', '".$img."')";
673 $resul=mysql_query($quer);
675 //9x in gestaan, dit is 10e dus lintje (goud)
676 if($row1[0]=='10'){
677 $img="t112_1";
678 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '16', '0', '".$allyweek."', 'Ten', '".$img."')";
679 $resul=mysql_query($quer);
683 //je staat voor 3e / 5e / 10e keer in de top 10 overvallers
684 //Pak de top10 overvallers
685 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY RR DESC Limit 10");
686 while($row = mysql_fetch_array($result)){
688 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 4 AND plaats<=3";
689 $result1=mysql_query($query1);
690 $row1=mysql_fetch_row($result1);
693 //2x in gestaan, dit is 3e dus lintje (brons)
694 if($row1[0]=='3'){
695 $img="t160_1";
696 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$allyweek."', 'Three', '".$img."')";
697 $resul=mysql_query($quer);
699 //4x in gestaan, dit is 5e dus lintje (zilver)
700 if($row1[0]=='5'){
701 $img="t161_1";
702 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$allyweek."', 'Five', '".$img."')";
703 $resul=mysql_query($quer);
705 //9x in gestaan, dit is 10e dus lintje (goud)
706 if($row1[0]=='10'){
707 $img="t162_1";
708 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '9', '0', '".$allyweek."', 'Ten', '".$img."')";
709 $resul=mysql_query($quer);
711 } //je staat voor 3e / 5e / 10e keer in de top 10 overvallers
712 //Pak de top10 overvallers
713 $result = mysql_query("SELECT * FROM ".TB_PREFIX."alidata ORDER BY RR DESC Limit 10");
714 while($row = mysql_fetch_array($result)){
716 $query1="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid='".$row['id']."' AND categorie = 4 AND plaats<=10";
717 $result1=mysql_query($query1);
718 $row1=mysql_fetch_row($result1);
721 //2x in gestaan, dit is 3e dus lintje (brons)
722 if($row1[0]=='3'){
723 $img="t170_1";
724 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$allyweek."', 'Three', '".$img."')";
725 $resul=mysql_query($quer);
727 //4x in gestaan, dit is 5e dus lintje (zilver)
728 if($row1[0]=='5'){
729 $img="t171_1";
730 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$allyweek."', 'Five', '".$img."')";
731 $resul=mysql_query($quer);
733 //9x in gestaan, dit is 10e dus lintje (goud)
734 if($row1[0]=='10'){
735 $img="t172_1";
736 $quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values('".$row['id']."', '15', '0', '".$allyweek."', 'Ten', '".$img."')";
737 $resul=mysql_query($quer);
741 $query="SELECT * FROM ".TB_PREFIX."alidata ORDER BY id+0 DESC";
742 $result=mysql_query($query);
743 for ($i=0; $row=mysql_fetch_row($result); $i++){
744 mysql_query("UPDATE ".TB_PREFIX."alidata SET ap=0, dp=0, RR=0, clp=0 WHERE id = ".$row[0]."");
750 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
751 <html>
752 <head>
753 <title><?php echo SERVER_NAME ?></title>
754 <link REL="shortcut icon" HREF="favicon.ico"/>
755 <meta http-equiv="cache-control" content="max-age=0" />
756 <meta http-equiv="pragma" content="no-cache" />
757 <meta http-equiv="expires" content="0" />
758 <meta http-equiv="imagetoolbar" content="no" />
759 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
761 <script src="mt-full.js?0ac36" type="text/javascript"></script>
762 <script src="unx.js?0ac36" type="text/javascript"></script>
763 <script src="new.js?0ac36" type="text/javascript"></script>
764 <link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?f4b7c" rel="stylesheet" type="text/css" />
765 <link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7c" rel="stylesheet" type="text/css" />
766 <?php
767 if($session->gpack == null || GP_ENABLE == false) {
768 echo "
769 <link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
770 <link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
771 } else {
772 echo "
773 <link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
774 <link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
777 <script type="text/javascript">
779 window.addEvent('domready', start);
780 </script>
781 </head>
782 <body class="v35 ie ie8">
783 <div class="wrapper">
784 <img style="filter:chroma();" src="img/x.gif" id="msfilter" alt="" />
785 <div id="dynamic_header">
786 </div>
787 <?php include("Templates/header.tpl"); ?>
788 <div id="mid">
789 <?php include("Templates/menu.tpl"); ?>
791 <div id="content" class="login">
792 <?php
793 if(isset($_GET['giveout'])){?>
794 <h1><br/>Top 10 Medals</h1><br />
795 Done:<br />
796 -Top 10 Attacker<br />
797 -Top 10 Defender<br />
798 -Top 10 Robbers<br />
799 -Top 10 Alliance Attacker<br />
800 -Top 10 Alliance Defencer<br />
801 -Top 10 Alliance Robbers<br />
802 -Top 10 Alliance Climbers(Rank)<br />
803 -Top 10 Pop Climbers<br />
804 -Top 10 Rank Climbers<br />
805 -Bonus: Attacker AND Defender<br />
806 -Bonus: 3/5/10 times in a row top 3 Pop Climbers<br />
807 -Bonus: 3/5/10 times in a row top 3 Rank Climbers<br />
808 -Bonus: 3/5/10 times top 3 Attack<br />
809 -Bonus: 3/5/10 times top 3 Defence<br />
810 -Bonus: 3/5/10 times top 3 Robber<br />
812 -Bonus: 3/5/10 times in a row top 10 Attack<br />
813 -Bonus: 3/5/10 times in a row top 10 Defence<br />
814 -Bonus: 3/5/10 times in a row top 10 Pop Climbers<br />
815 -Bonus: 3/5/10 times in a row top 10 Rank Climbers<br />
816 -Bonus: 3/5/10 times in a row top 10 Robber<br />
820 <?php
821 } else{ ?><h1><br/>Top 10 Medals</h1><br />
822 Click <a href="?giveout">here</a>, to give the medals away for <b>week <?php echo $week; ?></b>!<br/>WARNING: Loading next page can take some time!
823 <?php } ?></div>
824 <div id="side_info" class="outgame">
825 </div>
827 <div class="clear"></div>
828 </div>
830 <div class="footer-stopper outgame"></div>
831 <div class="clear"></div>
833 <?php include("Templates/footer.tpl"); ?>
834 <div id="ce"></div>
835 </body>
836 </html>
837 <?php mysql_close(); ?>