Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
configmng.php
Go to the documentation of this file.
1 <?php
2 if(!defined('IN_ADMIN')) {
3  exit('Access Denied');
4 }
5 
6 if($command == 'edit') {
7 
8  $ednum = 0;
9  $edfmt = Array('authkey'=>'','bbsurl'=>'','gameurl'=>'','homepage'=>'','moveut'=>'int','moveutmin'=>'int','tplrefresh'=>'b','errorinfo'=>'b');
10  $edlist = Array();
11  $cmd_info = '';
12  foreach($edfmt as $key => $val){
13  if(isset($_POST[$key])){
14  ${'o_'.$key} = ${$key};
15  if($val == 'int'){
16  ${$key} = intval($_POST[$key]);
17  }elseif($val == 'b'){
18  intval($_POST[$key]) != 0 ? ${$key} = 1 : ${$key} = 0;
19  }else{
20  ${$key} = astrfilter($_POST[$key]);
21  }
22  if(${$key} != ${'o_'.$key}){
23  $ednum ++;
24  if(${$key}===''){
25  $cmd_info .= "$lang[$key] 已清空<br>";
26  }else{
27  $cmd_info .= "$lang[$key] 修改为 ${$key} <br>";
28  }
29  $edlist[$key] = ${$key};
30  }
31  }
32  }
33 
34  $cmd_info .= "提交的修改请求数量: $ednum <br>";
35 
36  if($ednum){
37  //$adminlog = '';
38  $configfile = file_get_contents('./config.inc.php');
39  foreach($edlist as $key => $val){
40  if($edfmt[$key] == 'int' || $edfmt[$key] == 'b'){
41  $configfile = preg_replace("/[$]{$key}\s*\=\s*-?[0-9]+;/is", "\${$key} = ${$key};", $configfile);
42  }else{
43  $configfile = preg_replace("/[$]{$key}\s*\=\s*[\"'].*?[\"'];/is", "\${$key} = '${$key}';", $configfile);
44  }
45 
46  //$adminlog .= setadminlog('configmng',$key,$val);
47  }
48  file_put_contents('./config.inc.php',$configfile);
49  //putadminlog($adminlog);
50  adminlog('configmng');
51  $cmd_info .= '服务参数已修改';
52  }
53 }
54 $sysnow = time();
55 list($nowsec,$nowmin,$nowhour,$nowday,$nowmonth,$nowyear,$nowwday,$nowyday,$nowisdst) = localtime($sysnow);
57 $nowyear += 1900;
58 $orin_time = $nowyear.$lang['year'].$nowmonth.$lang['month'].$nowday.$lang['day'].$nowhour.$lang['hour'].$nowmin.$lang['min'];
59 list($setsec,$setmin,$sethour,$setday,$setmonth,$setyear,$setwday,$setyday,$setisdst) = localtime($sysnow + $moveut*3600 + $moveutmin*60);
61 $setyear += 1900;
62 $set_time = $setyear.$lang['year'].$setmonth.$lang['month'].$setday.$lang['day'].$sethour.$lang['hour'].$setmin.$lang['min'];
63 
64 include template('admin_configmng');
65 ?>
while($gm=$db->fetch_array($result)) $cmd_info
Definition: gmlist.php:10
$moveutmin
Definition: config.inc.php:52
$setyear
Definition: configmng.php:61
if(!defined('IN_ADMIN')) if($command== 'edit') $sysnow
Definition: configmng.php:54
$set_time
Definition: configmng.php:62
$moveut
Definition: config.inc.php:49
$orin_time
Definition: configmng.php:58
【生存者数:<?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
$setmonth
Definition: configmng.php:60
astrfilter($str)
Definition: admin.php:91
$nowmonth
Definition: configmng.php:56
$nowyear
Definition: configmng.php:57
adminlog($op, $an1='', $an2='', $an3='')
Definition: admin.php:58