-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathadmin.php
100 lines (90 loc) · 2.56 KB
/
admin.php
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
94
95
96
97
98
99
100
<?php
define('CURSCRIPT', 'admin');
require './include/common.inc.php';
define('IN_ADMIN', TRUE);
require GAME_ROOT.'./gamedata/admincfg.php';
require GAME_ROOT.'./include/admin/admin.lang.php';
$admin_cmd_list = Array(
'configmng' => 9,
'systemmng' => 7,
'gamecfgmng' => 7,
'gmlist' => 9,
'urlist' => 6,
'banlistmng' => 6,
'vnmixlist' => 5,
'gamecheck' => 2,
'pcmng' => 5,
'npcmng' => 5,
'gameinfomng' => 5,
'roommng' => 5,
'antiAFKmng' => 4,
'templates_clean' => 4,
);
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='$cuser'");
if(!$db->num_rows($result)) { gexit($_ERROR['login_check'],__file__,__line__); }
$udata = $db->fetch_array($result);
if($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __file__, __line__); }
elseif(($udata['groupid'] <= 1)&&($cuser!==$gamefounder)) { gexit($_ERROR['no_admin'], __file__, __line__); }
if($cuser===$gamefounder){$mygroup=10;}
else{$mygroup = $udata['groupid'];}
$showdata = $cmd_info = false;
if($mode == 'admin_menu' && in_array($command, array_keys($admin_cmd_list))) {//进入子菜单的指令
if($mygroup >= $admin_cmd_list[$command]){
include_once GAME_ROOT."./include/admin/{$command}.php";
$showdata = ob_get_contents();
}else{
$cmd_info = $_ERROR['no_power'];
}
} elseif(in_array($mode, array_keys($admin_cmd_list))) {//子菜单内指令
if($mygroup >= $admin_cmd_list[$mode]){
include_once GAME_ROOT."./include/admin/{$mode}.php";
$showdata = ob_get_contents();
}else{
$cmd_info = $_ERROR['no_power'];
}
} elseif(!empty($mode)) {
$cmd_info = $_ERROR['wrong_adcmd'];
}
ob_clean();
include template('admin');
ob_end_flush();
function adminlog($op,$an1='',$an2='',$an3=''){
global $now,$cuser;
$alfile = GAME_ROOT.'./gamedata/adminlog.php';
if($op){
$aldata = "$now,$cuser,$op,$an1,$an2,$an3,\n";
writeover($alfile,$aldata,'ab+');
}
return;
}
function getstart($start = 0,$mode = ''){
global $showlimit;
$start = (int)$start;
if($mode == 'up') {
$start -= $showlimit;
$start = $start <= 0 ? 0 : $start;
} elseif($mode == 'down') {
$start += $showlimit;
} elseif($mode == 'ref') {
$start = 0;
} else {
$start = $start ? $start : 0;
}
return $start;
}
function setconfig($string) {
$string = str_replace('\'', '\\\'', $string);
return $string;
}
function astrfilter($str) {
if(is_array($str)) {
foreach($str as $key => $val) {
$str[$key] = astrfilter($val);
}
} else {
$str = str_replace(Array('eval',';',"'"),'',$str);//屏蔽会造成困扰的关键字;
}
return $str;
}
?>