Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
gamecfgmng.php
Go to the documentation of this file.
1 <?php
2 if(!defined('IN_ADMIN')) {
3  exit('Access Denied');
4 }
5 if($command == 'edit') {
6  $ednum = 0;
7  $edfmt = Array(
8  'areahour'=>'int',
9  'areaadd'=>'int',
10  'arealimit'=>'int',
11  'areaesc'=>'int',
12  'antiAFKertime'=>'int',
13  'corpseprotect'=>'int',
14  'coldtimeon'=>'b',
15  'showcoldtimer'=>'b',
16  'validlimit'=>'int',
17  'combolimit'=>'int',
18  'deathlimit'=>'int',
19  'splimit'=>'int',
20  'hplimit'=>'int',
21  'sleep_time'=>'int',
22  'heal_time'=>'int',
23  'teamlimit'=>'int'
24 
25  );
26  $edlist = Array();
27  $cmd_info = '';
28  foreach($edfmt as $key => $val){
29  if(isset($_POST[$key])){
30  ${'o_'.$key} = ${$key};
31  if($val == 'int'){
32  ${$key} = intval($_POST[$key]);
33  }elseif($val == 'b'){
34  intval($_POST[$key]) != 0 ? ${$key} = 1 : ${$key} = 0;
35  }else{
36  ${$key} = astrfilter($_POST[$key]);
37  }
38  if(${$key} != ${'o_'.$key}){
39  $ednum ++;
40  if(${$key}===''){
41  $cmd_info .= "$lang[$key] 已清空<br>";
42  }else{
43  $cmd_info .= "$lang[$key] 修改为 ${$key} <br>";
44  }
45  $edlist[$key] = ${$key};
46  }
47  }
48  }
49 
50  $cmd_info .= "提交的修改请求数量: $ednum <br>";
51 
52  if($ednum){
53  $adminlog = '';
54  $gamecfg_file = config('gamecfg',$gamecfg);
55  $file = file_get_contents($gamecfg_file);
56  foreach($edlist as $key => $val){
57  if($edfmt[$key] == 'int' || $edfmt[$key] == 'b'){
58  $file = preg_replace("/[$]{$key}\s*\=\s*-?[0-9]+;/is", "\${$key} = ${$key};", $file);
59  }else{
60  $file = preg_replace("/[$]{$key}\s*\=\s*[\"'].*?[\"'];/is", "\${$key} = '${$key}';", $file);
61  }
62 
63  }
64  file_put_contents($gamecfg_file,$file);
65  adminlog('gamecfgmng',$gamecfg);
66  $cmd_info .= '游戏数据修改完毕';
67  }
68 }
69 include template('admin_gamecfg');
70 ?>
while($gm=$db->fetch_array($result)) $cmd_info
Definition: gmlist.php:10
$gamecfg
Definition: system.php:22
【生存者数:<?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
config($file= '', $cfg=1)
astrfilter($str)
Definition: admin.php:91
adminlog($op, $an1='', $an2='', $an3='')
Definition: admin.php:58