Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
rank.php
Go to the documentation of this file.
1 <?php
2 
3 define('CURSCRIPT', 'rank');
4 
5 require './include/common.inc.php';
6 require './include/game.func.php';
7 
8 $result = $db->query("SELECT COUNT(*) FROM {$tablepre}users");
9 $count = $db->result($result,0);
10 if($ranklimit < 1){$ranklimit = 1;}
11 //$ostart = -1;
12 //if(!isset($command) || !isset($start) || $start < 0) {
13 // $ostart = $start = 0;
14 //}elseif($command == 'last'){
15 // $ostart = $start;
16 // $start -= $ranklimit;
17 //}elseif($command == 'next'){
18 // $ostart = $start;
19 // $start += $ranklimit;
20 //}
21 //
22 //if($count == 0){gexit('No data!');}
23 //if($start < 0){$start = 0;}
24 //elseif($start + $ranklimit > $count){
25 // if($count - $ranklimit >= 0){
26 // $start = $count - $ranklimit;
27 // }else{
28 // $start = 0;
29 // }
30 //}
31 
32 
33 //elseif($start + $ranklimit > $count){$ranklimit = $count - $start;}
34 
35 //$startnum = $start + 1;
36 //if($start + $ranklimit > $count){
37 // $endnum = $count;
38 //}else{
39 // $endnum = $start + $ranklimit;
40 //}
41 
42 if(!isset($checkmode) || $checkmode == 'credits'){
43  $result = $db->query("SELECT * FROM {$tablepre}users WHERE validgames>0 ORDER BY credits DESC, credits2 DESC, wingames DESC, uid ASC LIMIT $ranklimit");
44 }elseif($checkmode == 'credits2'){
45  $result = $db->query("SELECT * FROM {$tablepre}users WHERE validgames>0 ORDER BY credits2 DESC, credits DESC, wingames DESC, uid ASC LIMIT $ranklimit");
46 }elseif($checkmode == 'winrate'){
47  $mingames = $winratemingames >= 1 ? $winratemingames : 1;
48  $result = $db->query("SELECT * FROM {$tablepre}users WHERE validgames>='$mingames' ORDER BY (wingames/validgames) DESC, credits DESC, credits2 DESC, uid ASC LIMIT $ranklimit");
49 }
50 $rankdata = Array();
51 $n = 1;
52 while($data = $db->fetch_array($result)){
53  $data['img'] = $data['gender'] == 'm' ? 'm_'.$data['icon'].'.gif' : 'f_'.$data['icon'].'.gif';
54  //$data['motto'] = $data['motto'] ? rep_label($data['motto']) : '';
55  //$data['slhonour'] = $data['honour'] ? init_honourwords($data['honour'],99) : '';
56  //$data['honour'] = $data['honour'] ? init_honourwords($data['honour']) : '';
57  $data['number'] = $n;
58  $data['winrate'] = $data['wingames'] ? round($data['wingames']/$data['validgames']*100).'%' : '0%';
59  $rankdata[] = $data;
60  $n ++;
61 }
62 
63 if(isset($schname) && !empty($schname)){
64  $result = $db->query("SELECT * FROM {$tablepre}users WHERE username='$schname'");
65  if(!$db->num_rows($result)){
66  }
67 }
68 
69 if(isset($checkmode)){
70  include template('rankinfo');
71  $showdata['innerHTML']['rank'] = ob_get_contents();
72  ob_clean();
73  if(isset($error)){$showdata['innerHTML']['error'] = $error;}
75  echo $jgamedata;
76  ob_end_flush();
77 }else{
78  include template('rank');
79 }
80 
81 
82 
83 function schname($schname){
84  global $db,$tablepre;
85  $schrst = Array();
86  $result = $db->query("SELECT * FROM {$tablepre}users WHERE username='$schname'");
87  if($db->num_rows($result)){
88  $schobj = $db->fetch_array($result);
89  $result2=$db->query("SELECT COUNT FROM {$tablepre}users WHERE ");
90  }
91 }
92 ?>
$tablepre
Definition: config.inc.php:58
if($ranklimit< 1) if(!isset($checkmode)||$checkmode== 'credits') elseif($checkmode== 'credits2') elseif($checkmode== 'winrate') $rankdata
Definition: rank.php:50
$n
Definition: rank.php:51
$ranklimit
Definition: system.php:34
$winratemingames
Definition: gamecfg_1.php:39
$result
Definition: rank.php:8
schname($schname)
Definition: rank.php:83
$db
Definition: clear.php:32
【生存者数:<?php echo $alivenum?> 人】< input type="button"value="显示全部幸存者"onClick="$('alivemode').value='all';$('gbmode').value='none';postCmd('alive','alive.php');"></p > if($gamblingon &&$gamestate >=20) elseif($gamblingon &&$gamestate<=10)
Definition: 1_alive.tpl.php:18
$error
Definition: errorpage.php:2
$jgamedata
Definition: alive.php:173
$showdata
Definition: admin.php:34
$count
Definition: rank.php:9
compatible_json_encode($data)