From 65171b44137d1133fe221a5984a7afa07ae2fb26 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 5 Apr 2018 00:46:17 +0900 Subject: [PATCH] =?UTF-8?q?npc=20=EC=84=A0=ED=83=9D=EC=97=90=20validator?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/select_npc_post.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hwe/select_npc_post.php b/hwe/select_npc_post.php index 2f516c8c..fec0c792 100644 --- a/hwe/select_npc_post.php +++ b/hwe/select_npc_post.php @@ -4,9 +4,19 @@ namespace sammo; include "lib.php"; include "func.php"; +$v = new Validator($_POST); +$v +->rule('required', 'face') +->rule('integer', 'face'); +if(!$v->validate()){ + MessageBox($v->errorStr()); + echo ""; + exit(1); +} + $session = Session::requireLogin()->setReadOnly(); -$face = $_POST['face'];//TODO: face를 user_id에서 general.no 값을 이용하도록 변경 +$face = (int)$_POST['face']; $userID = $session->userID; $rootDB = RootDB::db(); @@ -29,7 +39,7 @@ if(!$npc){ exit(); } -$npcID = $npc['no']; + ########## 동일 정보 존재여부 확인. ########## $admin = $db->queryFirstRow('SELECT year,month,maxgeneral,turnterm,genius,npcmode from game limit 1'); @@ -78,6 +88,7 @@ if($npc['npc'] != 2) { } */ +$npcID = $npc['no']; $db->update('general', [ 'name2'=>$session->userName, 'npc'=>1, @@ -95,6 +106,7 @@ if(!$affected){ exit; } + $me = [ 'no'=>$npcID ];