diff --git a/che_close/_119_b.php b/che_close/_119_b.php
index 37ad360..e6d132e 100644
--- a/che_close/_119_b.php
+++ b/che_close/_119_b.php
@@ -2,6 +2,10 @@
include "lib.php";
include "func.php";
+$btn = Util::getReq('btn');
+$minute = Util::getReq('minute', 'int');
+$minute2 = Util::getReq('minute2', 'int');
+
$connect=dbConn();
$query = "select userlevel from general where user_id='$_SESSION[p_id]'";
diff --git a/che_close/_admin1_submit.php b/che_close/_admin1_submit.php
index 30a77a1..87dfa00 100644
--- a/che_close/_admin1_submit.php
+++ b/che_close/_admin1_submit.php
@@ -1,6 +1,15 @@
include "lib.php";
include "func.php";
+
+$msg = Util::getReq('msg');
+$btn = Util::getReq('btn');
+$log = Util::getReq('log');
+$starttime = Util::getReq('starttime', 'string', date('Y-m-d H:i:s'));
+$maxgeneral = Util::getReq('maxgeneral', 'int');
+$maxnation = Util::getReq('maxnation', 'int');
+$startyear = Util::getReq('startyear', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/_admin2_submit.php b/che_close/_admin2_submit.php
index bf3f0f1..5d5a317 100644
--- a/che_close/_admin2_submit.php
+++ b/che_close/_admin2_submit.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$weap = Util::getReq('weap', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/_admin3_submit.php b/che_close/_admin3_submit.php
index 2ba56ef..162e5e7 100644
--- a/che_close/_admin3_submit.php
+++ b/che_close/_admin3_submit.php
@@ -1,6 +1,12 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$notice = Util::getReq('notice');
+$genlist = Util::getReq('genlist', 'array_int');
+$msg = Util::getReq('msg');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/_admin4_submit.php b/che_close/_admin4_submit.php
index 84a5cf0..7723aa5 100644
--- a/che_close/_admin4_submit.php
+++ b/che_close/_admin4_submit.php
@@ -1,6 +1,11 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$genlist = Util::getReq('genlist', 'array_int');
+$msg = Util::getReq('msg');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/_admin5.php b/che_close/_admin5.php
index a607ee8..ceca2e4 100644
--- a/che_close/_admin5.php
+++ b/che_close/_admin5.php
@@ -1,6 +1,17 @@
include "lib.php";
include "func.php";
+
+$type = Util::getReq('type', 'int', 0);
+$type2 = Util::getReq('type2', 'int', 0);
+
+if($type < 0 || $type > 17){
+ $type = 0;
+}
+if($type2 < 0 || $type2 > 6){
+ $type2 = 0;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
@@ -28,12 +39,6 @@ if($me[userlevel] < 5) {
exit();
}
-if($type == 0) {
- $type = 0;
-}
-if($type2 == 0) {
- $type2 = 0;
-}
$sel[$type] = "selected";
$sel2[$type2] = "selected";
diff --git a/che_close/_admin5_submit.php b/che_close/_admin5_submit.php
index 6603e02..a10c7b5 100644
--- a/che_close/_admin5_submit.php
+++ b/che_close/_admin5_submit.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$nation = Util::getReq('nation', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/_admin6.php b/che_close/_admin6.php
index 1f124cc..83dec3b 100644
--- a/che_close/_admin6.php
+++ b/che_close/_admin6.php
@@ -1,6 +1,12 @@
include "lib.php";
include "func.php";
+
+$type = Util::getReq('type', 'int', 0);
+if($type < 0 || $type > 4){
+ $type = 0;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/_admin7.php b/che_close/_admin7.php
index 23da728..efa586b 100644
--- a/che_close/_admin7.php
+++ b/che_close/_admin7.php
@@ -1,6 +1,16 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$gen = Util::getReq('gen', 'int', 0);
+$type = Util::getReq('type', 'int', 0);
+
+if($type < 0 || $type > 3){
+ $type = 0;
+}
+
+
//로그인 검사
CheckLogin();
$connect = dbConn();
@@ -32,9 +42,6 @@ if($btn == '정렬하기') {
$gen = 0;
}
-if($type == 0) {
- $type = 0;
-}
$sel[$type] = "selected";
?>
diff --git a/che_close/_admin8.php b/che_close/_admin8.php
index 65680f8..2ecaeee 100644
--- a/che_close/_admin8.php
+++ b/che_close/_admin8.php
@@ -1,6 +1,11 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$gen = Util::getReq('gen', 'int', 0);
+$type = 0;
+
//로그인 검사
CheckLogin();
$connect = dbConn();
@@ -32,9 +37,6 @@ if($btn == '정렬하기') {
$gen = 0;
}
-if($type == 0) {
- $type = 0;
-}
$sel[$type] = "selected";
?>
diff --git a/che_close/a_bestGeneral.php b/che_close/a_bestGeneral.php
index 98088a5..b740267 100644
--- a/che_close/a_bestGeneral.php
+++ b/che_close/a_bestGeneral.php
@@ -1,6 +1,9 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/a_emperior.php b/che_close/a_emperior.php
index eb5f0ab..ef86d2b 100644
--- a/che_close/a_emperior.php
+++ b/che_close/a_emperior.php
@@ -1,6 +1,9 @@
include "lib.php";
include "func.php";
+
+$select = Util::getReq('select', 'int', 0);
+
$connect = dbConn();
increaseRefresh($connect, "왕조일람", 2);
?>
diff --git a/che_close/a_emperior2.php b/che_close/a_emperior2.php
index c5302a5..8498b9b 100644
--- a/che_close/a_emperior2.php
+++ b/che_close/a_emperior2.php
@@ -1,6 +1,9 @@
include "lib.php";
include "func.php";
+
+$select = Util::getReq('select', 'int', 0);
+
$connect = dbConn();
increaseRefresh($connect, "왕조일람", 2);
?>
diff --git a/che_close/a_genList.php b/che_close/a_genList.php
index e177378..1714fc8 100644
--- a/che_close/a_genList.php
+++ b/che_close/a_genList.php
@@ -1,6 +1,12 @@
include "lib.php";
include "func.php";
+
+$type = Util::getReq('type', 'int', 9);
+if ($type <= 0 || $type > 16) {
+ $type = 9;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/a_history.php b/che_close/a_history.php
index 7a3d128..2238339 100644
--- a/che_close/a_history.php
+++ b/che_close/a_history.php
@@ -3,6 +3,10 @@ $yearmonth = $_POST['yearmonth'];
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$yearmonth = Util::getReq('yearmonth', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
@@ -33,8 +37,8 @@ if(!$yearmonth) {
$year = $admin['year'];
$month = $admin['month'] - 1;
} else {
- $year = substr($yearmonth, 0, 3) - 0;
- $month = substr($yearmonth, 3, 2) - 0;
+ $year = intdiv($yearmonth, 100);
+ $month = $yearmonth % 100;
if($btn == "◀◀ 이전달") {
$month -= 1;
diff --git a/che_close/a_npcList.php b/che_close/a_npcList.php
index 5907fd0..e2f1a34 100644
--- a/che_close/a_npcList.php
+++ b/che_close/a_npcList.php
@@ -4,9 +4,11 @@ include "func.php";
$connect = dbConn();
increaseRefresh($connect, "빙의일람", 2);
-if($type == 0) {
+$type = Util::getReq('type', 'int', 1);
+if($type <= 0 || $type > 8){
$type = 1;
}
+
$sel[$type] = "selected";
?>
diff --git a/che_close/b_auction.php b/che_close/b_auction.php
index 42f051d..47bd3d1 100644
--- a/che_close/b_auction.php
+++ b/che_close/b_auction.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$msg = Util::getReq('msg');
+$msg2 = Util::getReq('msg2');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/b_battleCenter.php b/che_close/b_battleCenter.php
index 3d73805..ec8a9d0 100644
--- a/che_close/b_battleCenter.php
+++ b/che_close/b_battleCenter.php
@@ -1,6 +1,15 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$gen = Util::getReq('gen', 'int', 0);
+$type = Util::getReq('type', 'int', 0);
+
+if ($type < 0 || $type > 3) {
+ $type = 0;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/b_currentCity.php b/che_close/b_currentCity.php
index b17f238..d39368b 100644
--- a/che_close/b_currentCity.php
+++ b/che_close/b_currentCity.php
@@ -1,6 +1,9 @@
include "lib.php";
include "func.php";
+
+$citylist = Util::getReq('citylist', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/b_genList.php b/che_close/b_genList.php
index 7bd1184..0da5d46 100644
--- a/che_close/b_genList.php
+++ b/che_close/b_genList.php
@@ -1,6 +1,12 @@
include "lib.php";
include "func.php";
+
+$type = Util::getReq('type', 'int', 7);
+if ($type <= 0 || $type > 8) {
+ $type = 7;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/b_myCityInfo.php b/che_close/b_myCityInfo.php
index 693474c..1c5dcdd 100644
--- a/che_close/b_myCityInfo.php
+++ b/che_close/b_myCityInfo.php
@@ -1,6 +1,12 @@
include "lib.php";
include "func.php";
+
+$type = Util::getReq('type', 'int', 10);
+if ($type <= 0 || $type > 12) {
+ $type = 10;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/b_myGenInfo.php b/che_close/b_myGenInfo.php
index a6e8b37..58fb600 100644
--- a/che_close/b_myGenInfo.php
+++ b/che_close/b_myGenInfo.php
@@ -1,6 +1,12 @@
include "lib.php";
include "func.php";
+
+$type = Util::getReq('type', 'int', 1);
+if($type <= 0 || $type > 15) {
+ $type = 1;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/b_myPage.php b/che_close/b_myPage.php
index 11126e4..be50265 100644
--- a/che_close/b_myPage.php
+++ b/che_close/b_myPage.php
@@ -1,6 +1,29 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$map = Util::getReq('map', 'int', 0);
+$mode = Util::getReq('mode', 'int', 2);
+$tnmt = Util::getReq('tnmt', 'int', 1);
+$skin = Util::getReq('skin', 'int', 1);
+
+if($map < 0 || $map > 2){
+ $map = 0;
+}
+
+if($mode < 0 || $mode > 2){
+ $mode = 2;
+}
+
+if($tnmt < 0 || $tnmt > 1){
+ $tnmt = 1;
+}
+
+if($skin < 0 || $skin > 17){
+ $skin = 1;
+}
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_auction.php b/che_close/c_auction.php
index 42fbcfa..de70299 100644
--- a/che_close/c_auction.php
+++ b/che_close/c_auction.php
@@ -1,6 +1,16 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$amount = Util::getReq('amount', 'int');
+$cost = Util::getReq('cost', 'int');
+$topv = Util::getReq('topv', 'int');
+$value = Util::getReq('value', 'int');
+$term = Util::getReq('term', 'int');
+$stuff = Util::getReq('stuff', 'int');
+$sel = Util::getReq('sel', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_betting.php b/che_close/c_betting.php
index 7e4b666..5740ad8 100644
--- a/che_close/c_betting.php
+++ b/che_close/c_betting.php
@@ -23,7 +23,7 @@ $me = MYDB_fetch_array($result);
for($i=0; $i < 16; $i++) {
if(${"btn{$i}"} == "베팅!") {
- $gold = ${"gold{$i}"};
+ $gold = (int)${"gold{$i}"};
$mebet = $me["bet{$i}"];
if($gold >= 10 && $gold <= 1000) {
if($gold + 500 <= $me[gold] && $gold + $mebet <= 1000 && $gold + $me[bet] <= 1000) {
diff --git a/che_close/c_chiefboard.php b/che_close/c_chiefboard.php
index 75ab286..19f796b 100644
--- a/che_close/c_chiefboard.php
+++ b/che_close/c_chiefboard.php
@@ -3,6 +3,12 @@
include "lib.php";
include "func.php";
+
+$title = Util::getReq('title');
+$msg = Util::getReq('msg');
+$num = Util::getReq('num', 'int');
+$reply = Util::getReq('reply');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_dipcenter.php b/che_close/c_dipcenter.php
index 1ef35f5..b2aab8a 100644
--- a/che_close/c_dipcenter.php
+++ b/che_close/c_dipcenter.php
@@ -3,6 +3,14 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$msg = Util::getReq('msg');
+$scoutmsg = Util::getReq('scoutmsg');
+$rate = Util::getReq('rate', 'int');
+$bill = Util::getReq('bill', 'int');
+$secretlimit = Util::getReq('secretlimit', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_double.php b/che_close/c_double.php
index 86d341a..9345599 100644
--- a/che_close/c_double.php
+++ b/che_close/c_double.php
@@ -3,6 +3,17 @@
include "lib.php";
include "func.php";
+
+$turn = Util::getReq('turn', 'array_int');
+$command = Util::getReq('command', 'int', 0);
+$cost = Util::getReq('cost', 'int');
+$name = Util::getReq('name');
+$nationname = Util::getReq('nationname', 'string', '');
+$note = Util::getReq('note', 'string', '');
+$double = Util::getReq('double', 'int', 0);
+$third = Util::getReq('third', 'int', 0);
+$fourth = Util::getReq('fourth', 'int', 0);
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_msgsubmit.php b/che_close/c_msgsubmit.php
index fdf9155..797a03c 100644
--- a/che_close/c_msgsubmit.php
+++ b/che_close/c_msgsubmit.php
@@ -3,6 +3,10 @@
include "lib.php";
include "func.php";
+
+$msg = Util::getReq('msg');
+$genlist = Util::getReq('genlist', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/c_myBossInfo.php b/che_close/c_myBossInfo.php
index 0bab426..730a855 100644
--- a/che_close/c_myBossInfo.php
+++ b/che_close/c_myBossInfo.php
@@ -3,6 +3,13 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$level = Util::getReq('level', 'int');
+$genlist = Util::getReq('genlist', 'int');
+$outlist = Util::getReq('outlist', 'int');
+$citylist = Util::getReq('citylist', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
@@ -25,6 +32,11 @@ if($btn == "임명") {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
+ if(!$general){
+ echo "";
+ exit();
+ }
+
//임명할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
if($general[level] == 12 || $meLevel < 5 || ($general[nation] != $me[nation] && $genlist != 0)) {
echo "";
@@ -35,6 +47,11 @@ if($btn == "임명") {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
+ if(!$general){
+ echo "";
+ exit();
+ }
+
//추방할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
if($general[level] == 12 || $meLevel < 5 || ($general[nation] != $me[nation] && $outlist != 0)) {
echo "";
diff --git a/che_close/c_nationboard.php b/che_close/c_nationboard.php
index 3a8723c..8eb1955 100644
--- a/che_close/c_nationboard.php
+++ b/che_close/c_nationboard.php
@@ -3,6 +3,11 @@
include "lib.php";
include "func.php";
+
+$title = Util::getReq('title');
+$msg = Util::getReq('msg');
+$num = Util::getReq('num', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_nationrule.php b/che_close/c_nationrule.php
index a7f64bf..2c40f81 100644
--- a/che_close/c_nationrule.php
+++ b/che_close/c_nationrule.php
@@ -3,6 +3,9 @@
include "lib.php";
include "func.php";
+
+$msg = Util::getReq('msg');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_tournament.php b/che_close/c_tournament.php
index 2c6a631..b827c90 100644
--- a/che_close/c_tournament.php
+++ b/che_close/c_tournament.php
@@ -3,6 +3,18 @@
include "lib.php";
include "func.php";
+
+// $btn, $msg
+$btn = Util::getReq('btn');
+$msg = Util::getReq('msg');
+
+//관리자용
+$auto = Util::getReq('auto', 'int');
+$type = Util::getReq('type', 'int');
+$gen = Util::getReq('gen', 'int');
+$sel = Util::getReq('sel', 'int');
+$trig = Util::getReq('trig', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_troop.php b/che_close/c_troop.php
index 0c6e36a..625274a 100644
--- a/che_close/c_troop.php
+++ b/che_close/c_troop.php
@@ -3,6 +3,12 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$name = Util::getReq('name');
+$gen = Util::getReq('gen', 'int');
+$troop = Util::getReq('troop', 'int');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/c_vote.php b/che_close/c_vote.php
index 0345c04..4f432b6 100644
--- a/che_close/c_vote.php
+++ b/che_close/c_vote.php
@@ -1,6 +1,13 @@
include "lib.php";
include "func.php";
+
+$btn = Util::getReq('btn');
+$sel = Util::getReq('sel', 'int');
+$comment = Util::getReq('comment');
+$title = Util::getReq('title');
+$str = Util::getReq('str');
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/d_ally.php b/che_close/d_ally.php
index 543c6fb..b078eb7 100644
--- a/che_close/d_ally.php
+++ b/che_close/d_ally.php
@@ -1,6 +1,11 @@
include "lib.php";
include "func.php";
+
+$ok = Util::getReq('ok');
+$when = Util::getReq('when', 'int');
+$gen = Util::getReq('gen', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/d_cancel.php b/che_close/d_cancel.php
index d13160d..0515f3d 100644
--- a/che_close/d_cancel.php
+++ b/che_close/d_cancel.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$ok = Util::getReq('ok');
+$gen = Util::getReq('gen', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/d_cease.php b/che_close/d_cease.php
index 683fe88..9cc4989 100644
--- a/che_close/d_cease.php
+++ b/che_close/d_cease.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$ok = Util::getReq('ok');
+$gen = Util::getReq('gen', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/d_merge.php b/che_close/d_merge.php
index 4e934c1..30ae13e 100644
--- a/che_close/d_merge.php
+++ b/che_close/d_merge.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$ok = Util::getReq('ok');
+$gen = Util::getReq('gen', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/d_scout.php b/che_close/d_scout.php
index 6383ee2..74f97bc 100644
--- a/che_close/d_scout.php
+++ b/che_close/d_scout.php
@@ -1,6 +1,9 @@
include "lib.php";
include "func.php";
+
+$gen = Util::getReq('gen', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/d_surrender.php b/che_close/d_surrender.php
index a1e18d7..9225f08 100644
--- a/che_close/d_surrender.php
+++ b/che_close/d_surrender.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$ok = Util::getReq('ok');
+$gen = Util::getReq('gen', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/func.php b/che_close/func.php
index 2293211..261983d 100644
--- a/che_close/func.php
+++ b/che_close/func.php
@@ -7,6 +7,98 @@ include "func_auction.php";
include "func_string.php";
include "func_history.php";
+
+class Util{
+ private function __construct(){
+
+ }
+
+ private static function _parseReq($value, $type)
+ {
+ if (is_array($value)) {
+ if ($type === 'array_int') {
+ return array_map('intval', $value);
+ }
+
+ if ($type === 'array_string') {
+ return array_map(function ($item) {
+ return (string)$item;
+ }, $value);
+ }
+
+ if ($type === 'array') {
+ return $value;
+ }
+
+ throw new \InvalidArgumentException('지원할 수 없는 type 지정. array 가 붙은 type이어야 합니다');
+ }
+
+ if ($type === 'bool') {
+ $value = strtolower($value);
+ if ($value === 'false' || $value === 'no' || $value === 'n' || $value === 'x' || $value === 'null') {
+ return false;
+ }
+ return !!$value;
+ }
+ if ($type === 'int') {
+ return (int)$value;
+ }
+ if ($type === 'float') {
+ return (float)$value;
+ }
+ if ($type === 'string') {
+ return (string)$value;
+ }
+
+ throw new \InvalidArgumentException('올바르지 않은 type 지정');
+ }
+
+ /**
+ * $_POST, $_GET에서 값을 가져오는 함수. Util::array_get($_POST[$name])을 축약 가능.
+ * 타입이 복잡해질 경우 이 함수를 통하지 않고 json으로 요청할 것을 권장.
+ *
+ * @param string $name 가져오고자 하는 key 이름.
+ * @param string $type 가져오고자 하는 type. [string, int, float, bool, array, array_string, array_int]
+ * @param mixed $ifNotExists 만약 $_POST와 $_GET에 값이 없을 경우 반환하는 변수. 이 값은 $type을 검사하지 않음.
+ * @return int|float|string|array|null
+ * @throws \InvalidArgumentException
+ */
+ public static function getReq($name, $type = 'string', $ifNotExists = null)
+ {
+ if (isset($_POST[$name])) {
+ $value = $_POST[$name];
+ } elseif (isset($_GET[$name])) {
+ $value = $_GET[$name];
+ } else {
+ return $ifNotExists;
+ }
+
+ return static::_parseReq($value, $type);
+ }
+
+ /**
+ * $_POST에서 값을 가져오는 함수. Util::array_get($_POST[$name])을 축약 가능. $_GET에서도 가져올 수 있다면 getReq 사용.
+ * 타입이 복잡해질 경우 이 함수를 통하지 않고 json으로 요청할 것을 권장.
+ *
+ * @param string $name 가져오고자 하는 key 이름.
+ * @param string $type 가져오고자 하는 type. [string, int, float, bool, array, array_string, array_int]
+ * @param mixed $ifNotExists 만약 $_GET과 $_POST에 값이 없을 경우 반환하는 변수. 이 값은 $type을 검사하지 않음.
+ * @return int|float|string|array|null
+ * @throws \InvalidArgumentException
+ */
+ public static function getPost($name, $type = 'string', $ifNotExists = null)
+ {
+ if (isset($_POST[$name])) {
+ $value = $_POST[$name];
+ } else {
+ return $ifNotExists;
+ }
+
+ return static::_parseReq($value, $type);
+ }
+}
+
+
/// 0.0~1.0 사이의 랜덤 float
function randF(){
return mt_rand() / mt_getrandmax();
diff --git a/che_close/install.php b/che_close/install.php
index 04057a2..83ee9d9 100644
--- a/che_close/install.php
+++ b/che_close/install.php
@@ -1,7 +1,7 @@
include "lib.php";
-$justReset = isset($_GET['just_reset'])?intval($_GET['just_reset']):0;
+$justReset = Util::getReq('just_reset', 'int', 0);
if(file_exists("d_setting/set.php")){
//DB 리셋만 하려는 것인지 검사 필요.
diff --git a/che_close/install_ok.php b/che_close/install_ok.php
index 0c0a05d..d9f312a 100644
--- a/che_close/install_ok.php
+++ b/che_close/install_ok.php
@@ -3,7 +3,7 @@ include "lib.php";
include "schema.sql";
include "func.php";
-$justReset = isset($_POST['just_reset'])?intval($_POST['just_reset']):0;
+$justReset = Util::getReq('just_reset', 'int', 0);
if(file_exists("d_setting/set.php")){
diff --git a/che_close/join_post.php b/che_close/join_post.php
index 2f573b1..5c01877 100644
--- a/che_close/join_post.php
+++ b/che_close/join_post.php
@@ -6,8 +6,8 @@ $id = $_POST[id];
$pw = $_POST[pw];
$name = $_POST[name];
$name = _String::NoSpecialCharacter($name);
-$pic = $_POST[pic];
-$character = $_POST[character];
+$pic = (int)$_POST[pic];
+$character = (int)$_POST[character];
$leader = floor($_POST['leader']);
$power = floor($_POST['power']);
diff --git a/che_close/preprocessing.php b/che_close/preprocessing.php
index 37c27c5..1b3932a 100644
--- a/che_close/preprocessing.php
+++ b/che_close/preprocessing.php
@@ -1,6 +1,11 @@
include "lib.php";
include "func.php";
+
+$turn = Util::getReq('turn', 'array_int');
+$sel = Util::getReq('sel', 'int');
+$commandtype = Util::getReq('commandtype', 'int');
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/che_close/processing.php b/che_close/processing.php
index 622d81f..96014df 100644
--- a/che_close/processing.php
+++ b/che_close/processing.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$commandtype = Util::getReq('commandtype', 'int', 0);
+$turn = Util::getReq('turn', 'array_int', array(0));
+
//로그인 검사
CheckLogin();
$connect = dbConn();
diff --git a/che_close/select_npc_post.php b/che_close/select_npc_post.php
index bde288d..d563c64 100644
--- a/che_close/select_npc_post.php
+++ b/che_close/select_npc_post.php
@@ -4,7 +4,7 @@ include "func.php";
$id = $_POST[id];
$pw = $_POST[pw];
-$face = $_POST[face];
+$face = (int)$_POST[face];
$pwTemp = substr($pw, 0, 32);
diff --git a/che_close/turn.php b/che_close/turn.php
index 4673b24..33f9863 100644
--- a/che_close/turn.php
+++ b/che_close/turn.php
@@ -1,6 +1,10 @@
include "lib.php";
include "func.php";
+
+$type = Util::getReq('type', 'int', 0);
+$sel = Util::getReq('sel', 'int', 1);
+
//로그인 검사
CheckLogin(1);
$connect = dbConn();
diff --git a/i_entrance/adminPost.php b/i_entrance/adminPost.php
index 39382d6..52cd008 100644
--- a/i_entrance/adminPost.php
+++ b/i_entrance/adminPost.php
@@ -4,10 +4,10 @@
// $_POST['notice'] : 공지
// $_POST['server'] : 서버 인덱스
// $_POST['select'] : 0: 폐쇄, 1: 리셋, 2: 오픈
-$action = $_POST['action'];
+$action = (int)$_POST['action'];
$notice = $_POST['notice'];
-$server = $_POST['server'];
-$select = $_POST['select'];
+$server = (int)$_POST['server'];
+$select = (int)$_POST['select'];
require_once('_common.php');
require_once(ROOT.W.F_FUNC.W.'class._JSON.php');
diff --git a/i_entrance/member/Post.php b/i_entrance/member/Post.php
index 1b503db..a661ba3 100644
--- a/i_entrance/member/Post.php
+++ b/i_entrance/member/Post.php
@@ -2,8 +2,8 @@
// 외부 파라미터
// $_POST['select'] : 처리종류
// $_POST['no'] : NO
-$select = $_POST['select'];
-$no = $_POST['no'];
+$select = (int)$_POST['select'];
+$no = (int)$_POST['no'];
require_once('_common.php');
require_once(ROOT.W.F_FUNC.W.'class._JSON.php');