정적 분석 결과 반영. 익명 함수로 전환. POST 변수명.

This commit is contained in:
2018-04-07 13:45:17 +09:00
parent 28aa4c004b
commit 6140da5783
6 changed files with 51 additions and 41 deletions
+12
View File
@@ -11,6 +11,18 @@ if($session->userGrade < 5){
echo '_119.php';//TODO:debug all and replace
}
$v = new Validator($_POST);
$v->rule('integer', [
'minute',
'minutes2'
]);
if(!$v->validate()){
Error($v->errorStr());
}
$minute = Util::toInt(Util::array_get($_POST['minute']));
$minute2 = Util::toInt(Util::array_get($_POST['minute2']));
$db = DB::db();
$connect=$db->get();
-3
View File
@@ -49,9 +49,6 @@ $admin = getAdmin();
<tr><td width=110 align=right>중원정세추가</td>
<td colspan=3><input type=textarea size=90 maxlength=80 style=color:white;background-color:black; name=log><input type=submit name=btn value=로그쓰기></td></td>
</tr>
<tr><td width=110 align=right>쿼리 요청</td>
<td colspan=3><input type=textarea size=90 maxlength=150 style=color:white;background-color:black; name=q><input type=submit name=btn value=요청></td></td>
</tr>
<tr>
<td width=110 align=right>시작시간변경</td>
<td width=285><input type=text size=20 maxlength=20 style=color:white;background-color:black;text-align:right; name=starttime value='<?=$admin['starttime'];?>'><input type=submit name=btn value=변경1></td>
+13 -6
View File
@@ -6,26 +6,33 @@ include "func.php";
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$admin = getAdmin();
if($session->userGrade < 5) {
//echo "<script>location.replace('_admin1.php');</script>";
echo '_admin1.php';//TODO:debug all and replace
}
$v = new Validator($_POST);
$v->rule('integer', [
'maxgeneral',
'minutes2'
])->rule('dateFormat', [
'starttime'
]);
if(!$v->validate()){
Error($v->errorStr());
}
$db = DB::db();
$connect=$db->get();
$admin = getAdmin();
switch($btn) {
case "변경":
$msg = addslashes(SQ2DQ($msg));
$query = "update game set msg='$msg'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break;
case "요청":
$query = $q;
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break;
case "로그쓰기":
$lognum = $admin['historyindex'] + 1;
if($lognum >= 29) { $lognum = 0; }
+1 -1
View File
@@ -83,12 +83,12 @@ function Error($message, $url="")
if(!$url){
$url = $_SERVER['REQUEST_URI'];
}
WebUtil::setHeaderNoCache();
file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND);
$templates = new \League\Plates\Engine('templates');
ob_get_flush();
WebUtil::setHeaderNoCache();
die($templates->render('error', [
'message' => $message