All Data Structures Namespaces Files Functions Variables Pages
rank.php
Go to the documentation of this file.
<?php
define('CURSCRIPT', 'rank');
require './include/common.inc.php';
require './include/game.func.php';
$result = $db->query("SELECT COUNT(*) FROM {$tablepre}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 {$tablepre}users WHERE validgames>0 ORDER BY credits DESC, credits2 DESC, wingames DESC, uid ASC LIMIT $ranklimit");
}elseif($checkmode == 'credits2'){
$result = $db->query("SELECT * FROM {$tablepre}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 {$tablepre}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%';
$rankdata[] = $data;
$n ++;
}
if(isset($schname) && !empty($schname)){
$result = $db->query("SELECT * FROM {$tablepre}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 {$tablepre}users WHERE username='$schname'");
if($db->num_rows($result)){
$schobj = $db->fetch_array($result);
$result2=$db->query("SELECT COUNT FROM {$tablepre}users WHERE ");
}
}
?>
$tablepre
$tablepre
Definition: config.inc.php:58
$rankdata
if($ranklimit< 1) if(!isset($checkmode)||$checkmode== 'credits') elseif($checkmode== 'credits2') elseif($checkmode== 'winrate') $rankdata
Definition: rank.php:50
$n
$n
Definition: rank.php:51
$ranklimit
$ranklimit
Definition: system.php:34
$winratemingames
$winratemingames
Definition: gamecfg_1.php:39
$result
$result
Definition: rank.php:8
schname
schname($schname)
Definition: rank.php:83
$db
$db
Definition: clear.php:32
elseif
【生存者数：<?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
$error
Definition: errorpage.php:2
$jgamedata
$jgamedata
Definition: alive.php:173
$showdata
$showdata
Definition: admin.php:34
$count
$count
Definition: rank.php:9
compatible_json_encode
compatible_json_encode($data)
Definition: global.func.php:185