-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathrank.php
More file actions
93 lines (81 loc) · 2.94 KB
/
rank.php
File metadata and controls
93 lines (81 loc) · 2.94 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
82
83
84
85
86
87
88
89
90
91
92
93
<?php
define('CURSCRIPT', 'rank');
require './include/common.inc.php';
require './include/game.func.php';
$result = $db->query("SELECT COUNT(*) FROM {$gtablepre}users");
$count = $db->result($result,0);
if($ranklimit < 1){$ranklimit = 1;}
//$ostart = -1;
//if(!isset($command) || !isset($start) || $start < 0) {
// $ostart = $start = 0;
//}elseif($command == 'last'){
// $ostart = $start;
// $start -= $ranklimit;
//}elseif($command == 'next'){
// $ostart = $start;
// $start += $ranklimit;
//}
//
//if($count == 0){gexit('No data!');}
//if($start < 0){$start = 0;}
//elseif($start + $ranklimit > $count){
// if($count - $ranklimit >= 0){
// $start = $count - $ranklimit;
// }else{
// $start = 0;
// }
//}
//elseif($start + $ranklimit > $count){$ranklimit = $count - $start;}
//$startnum = $start + 1;
//if($start + $ranklimit > $count){
// $endnum = $count;
//}else{
// $endnum = $start + $ranklimit;
//}
if(!isset($checkmode) || $checkmode == 'credits'){
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE validgames>0 ORDER BY credits DESC, credits2 DESC, wingames DESC, uid ASC LIMIT $ranklimit");
}elseif($checkmode == 'credits2'){
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE validgames>0 ORDER BY credits2 DESC, credits DESC, wingames DESC, uid ASC LIMIT $ranklimit");
}elseif($checkmode == 'winrate'){
$mingames = $winratemingames >= 1 ? $winratemingames : 1;
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE validgames>='$mingames' ORDER BY (wingames/validgames) DESC, credits DESC, credits2 DESC, uid ASC LIMIT $ranklimit");
}
$rankdata = Array();
$n = 1;
while($data = $db->fetch_array($result)){
$data['img'] = $data['gender'] == 'm' ? 'm_'.$data['icon'].'.gif' : 'f_'.$data['icon'].'.gif';
//$data['motto'] = $data['motto'] ? rep_label($data['motto']) : '';
//$data['slhonour'] = $data['honour'] ? init_honourwords($data['honour'],99) : '';
//$data['honour'] = $data['honour'] ? init_honourwords($data['honour']) : '';
$data['number'] = $n;
$data['winrate'] = $data['wingames'] ? round($data['wingames']/$data['validgames']*100).'%' : '0%';
$data['nickinfo'] = !empty($data['nick']) ? titles_get_desc($data['nick']) : titles_get_desc(0);
$rankdata[] = $data;
$n ++;
}
if(isset($schname) && !empty($schname)){
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='$schname'");
if(!$db->num_rows($result)){
}
}
if(isset($checkmode)){
include template('rankinfo');
$showdata['innerHTML']['rank'] = ob_get_contents();
ob_clean();
if(isset($error)){$showdata['innerHTML']['error'] = $error;}
$jgamedata = compatible_json_encode($showdata);
echo $jgamedata;
ob_end_flush();
}else{
include template('rank');
}
function schname($schname){
global $db,$tablepre;
$schrst = Array();
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='$schname'");
if($db->num_rows($result)){
$schobj = $db->fetch_array($result);
$result2=$db->query("SELECT COUNT FROM {$gtablepre}users WHERE ");
}
}
?>