From 6220d030dc4f4779995b8463f7cd5868ce6ce0b2 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 12 Apr 2018 02:57:53 +0900 Subject: [PATCH] =?UTF-8?q?$=5FPOST,=20$=5FGET=20=EB=82=A8=EC=9D=80=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=A0=9C=EA=B1=B0.=20=EC=97=B0=EA=B0=90?= =?UTF-8?q?=20=EC=A7=80=EB=8F=84=20=EB=B0=9B=EC=95=84=EC=98=A4=EB=8A=94=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=9E=AC=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/a_history.php | 4 +++- hwe/j_load_scenarios.php | 2 +- hwe/map_history.php | 37 ++++++++++++++++++++--------------- i_entrance/j_delete_me.php | 2 +- i_entrance/j_set_userlist.php | 6 +++--- i_other/help.php | 2 +- oauth_kakao/oauth.php | 2 +- 7 files changed, 31 insertions(+), 24 deletions(-) diff --git a/hwe/a_history.php b/hwe/a_history.php index 31fdce5f..92ab09fc 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -4,7 +4,8 @@ namespace sammo; include "lib.php"; include "func.php"; $btn = Util::getReq('btn'); -$yearmonth = $_POST['yearmonth']; +$yearmonth = Util::getReq('yearmonth'); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); @@ -38,6 +39,7 @@ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), " $history = MYDB_fetch_array($result); $e = ($history['year']*12) + $history['month']; +//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요. if (!$yearmonth) { $year = $admin['year']; $month = $admin['month'] - 1; diff --git a/hwe/j_load_scenarios.php b/hwe/j_load_scenarios.php index 5aacc776..506f7466 100644 --- a/hwe/j_load_scenarios.php +++ b/hwe/j_load_scenarios.php @@ -12,7 +12,7 @@ if($session->userGrade < 5){ } -$scenarioIdx = Util::toInt(Util::array_get($_GET['scenarioIdx'])); +$scenarioIdx = Util::getReq('scenarioIdx', 'int'); if ($scenarioIdx !== null) { //TODO: preview 지도 출력 diff --git a/hwe/map_history.php b/hwe/map_history.php index 21dee783..14003207 100644 --- a/hwe/map_history.php +++ b/hwe/map_history.php @@ -1,37 +1,42 @@ false, + 'reason'=>'Invalid Referer' + ]); } if(!$year || !$month) { - exit(1); + Json::die([ + 'result'=>false, + 'reason'=>'year, month가 지정되지 않았습니다' + ]); } -include "lib.php"; -include "func.php"; + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $db = DB::db(); $connect=$db->get(); -$query = "select map from history where year='$year' and month='$month'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$history = MYDB_fetch_array($result); +$map = $db->queryFirstField('SELECT map FROM history WHERE year=%i AND month=%i', $year, $month); -if(!$history['map']) { - exit(1); +if(!$map){ + Json::die([ + 'result'=>false, + 'reason'=>'해당하는 연월의 지도가 없습니다' + ]); } -$map = $history['map']; -$map = str_replace('<_quot_>', "'", $map); -$map = str_replace('<_dquot_>', '"', $map); - -echo $map; +Json::die(Json::decode($map)); \ No newline at end of file diff --git a/i_entrance/j_delete_me.php b/i_entrance/j_delete_me.php index c999e113..235d8ecb 100644 --- a/i_entrance/j_delete_me.php +++ b/i_entrance/j_delete_me.php @@ -8,7 +8,7 @@ $userID = Session::getUserID(); // 외부 파라미터 // $_POST['pw'] : PW -$pw = $_POST['pw']; +$pw = Util::getReq('pw'); if(!$pw){ Json::die([ diff --git a/i_entrance/j_set_userlist.php b/i_entrance/j_set_userlist.php index 00ede015..64969dcb 100644 --- a/i_entrance/j_set_userlist.php +++ b/i_entrance/j_set_userlist.php @@ -13,9 +13,9 @@ if($session->userGrade < 6){ } // 외부 파라미터 -// $_POST['action'] : 처리종류 -// $_POST['user_id'] : 유저 이름 -// $_POST['param'] : 추가 파라미터 +// action : 처리종류 +// user_id : 유저 이름 +// param : 추가 파라미터 $action = Util::getReq('action'); $userID = Util::getReq('user_id'); diff --git a/i_other/help.php b/i_other/help.php index b713dc85..ac3d1f75 100644 --- a/i_other/help.php +++ b/i_other/help.php @@ -4,7 +4,7 @@ namespace sammo; require(__dir__.'/../vendor/autoload.php'); WebUtil::setHeaderNoCache(); -$category = Util::array_get($_GET['category'], 0); +$category = Util::getReq('category', 0); //FIXME: 겨우 category 구분을 위해 php를 써야하는가? JavaScript로 바꾸자 ?> diff --git a/oauth_kakao/oauth.php b/oauth_kakao/oauth.php index 2c121200..7ffe10a9 100644 --- a/oauth_kakao/oauth.php +++ b/oauth_kakao/oauth.php @@ -7,7 +7,7 @@ use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; WebUtil::setHeaderNoCache(); -$auth_code = Util::array_get($_GET['code']); +$auth_code = Util::getReq('code'); if(!$auth_code){ header('Location:oauth_fail.html');