Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
admin.php
Go to the documentation of this file.
1 <?php
2 
3 define('CURSCRIPT', 'admin');
4 
5 require './include/common.inc.php';
6 define('IN_ADMIN', TRUE);
7 require GAME_ROOT.'./gamedata/admincfg.php';
8 require GAME_ROOT.'./include/admin/admin.lang.php';
9 
11  'configmng' => 9,
12  'systemmng' => 7,
13  'gamecfgmng' => 7,
14  'gmlist' => 9,
15  'urlist' => 6,
16  'banlistmng' => 6,
17  'gamecheck' => 2,
18  'pcmng' => 5,
19  'npcmng' => 5,
20  'gameinfomng' => 5,
21  'antiAFKmng' => 4,
22 );
23 
24 if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
25 $result = $db->query("SELECT * FROM {$tablepre}users WHERE username='$cuser'");
26 if(!$db->num_rows($result)) { gexit($_ERROR['login_check'],__file__,__line__); }
27 $udata = $db->fetch_array($result);
28 if($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __file__, __line__); }
29 elseif(($udata['groupid'] <= 1)&&($cuser!==$gamefounder)) { gexit($_ERROR['no_admin'], __file__, __line__); }
30 
31 if($cuser===$gamefounder){$mygroup=10;}
32 else{$mygroup = $udata['groupid'];}
33 
34 $showdata = $cmd_info = false;
35 if($mode == 'admin_menu' && in_array($command, array_keys($admin_cmd_list))) {//进入子菜单的指令
36  if($mygroup >= $admin_cmd_list[$command]){
37  include_once GAME_ROOT."./include/admin/{$command}.php";
38  $showdata = ob_get_contents();
39  }else{
40  $cmd_info = $_ERROR['no_power'];
41  }
42 
43 } elseif(in_array($mode, array_keys($admin_cmd_list))) {//子菜单内指令
44  if($mygroup >= $admin_cmd_list[$mode]){
45  include_once GAME_ROOT."./include/admin/{$mode}.php";
46  $showdata = ob_get_contents();
47  }else{
48  $cmd_info = $_ERROR['no_power'];
49  }
50 } elseif(!empty($mode)) {
51  $cmd_info = $_ERROR['wrong_adcmd'];
52 }
53 ob_clean();
54 include template('admin');
55 ob_end_flush();
56 
57 
58 function adminlog($op,$an1='',$an2='',$an3=''){
59  global $now,$cuser;
60  $alfile = GAME_ROOT.'./gamedata/adminlog.php';
61  if($op){
62  $aldata = "$now,$cuser,$op,$an1,$an2,$an3,\n";
63  writeover($alfile,$aldata,'ab+');
64  }
65  return;
66 }
67 function getstart($start = 0,$mode = ''){
68  global $showlimit;
69  $start = (int)$start;
70  if($mode == 'up') {
71  $start -= $showlimit;
72  $start = $start <= 0 ? 0 : $start;
73  } elseif($mode == 'down') {
74  $start += $showlimit;
75  } elseif($mode == 'ref') {
76  $start = 0;
77  } else {
78  $start = $start ? $start : 0;
79  }
80  return $start;
81 }
82 function setconfig($string) {
83  if(!get_magic_quotes_gpc()) {
84  $string = str_replace('\'', '\\\'', $string);
85  } else {
86  $string = str_replace('\"', '"', $string);
87  }
88  return $string;
89 }
90 
91 function astrfilter($str) {
92  if(is_array($str)) {
93  foreach($str as $key => $val) {
94  $str[$key] = astrfilter($val);
95  }
96  } else {
97  $str = str_replace(Array('eval',';',"'"),'',$str);//屏蔽会造成困扰的关键字;
98  }
99  return $str;
100 }
101 ?>
while($gm=$db->fetch_array($result)) $cmd_info
Definition: gmlist.php:10
getstart($start=0, $mode= '')
Definition: admin.php:67
writeover($filename, $data, $method="rb+", $iflock=1, $check=1, $chmod=1)
$admin_cmd_list
Definition: admin.php:10
setconfig($string)
Definition: admin.php:82
$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
$gamefounder
Definition: config.inc.php:43
const GAME_ROOT
Definition: clear.php:6
$now
Definition: clear.php:23
$_ERROR
$showdata
Definition: admin.php:34
gexit($message= '', $file= '', $line=0)
Definition: global.func.php:30
astrfilter($str)
Definition: admin.php:91
if(!$db->num_rows($result)) $udata
Definition: admin.php:27
if(!$cuser||!$cpass) $result
Definition: admin.php:25
$cpass
Definition: common.inc.php:207
adminlog($op, $an1='', $an2='', $an3='')
Definition: admin.php:58
$start
Definition: npcmng.php:12
$showlimit
Definition: admincfg.php:4