From a3f83d1e95eca5bc4e6d1a98ac17f3266e419175 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 24 Mar 2018 20:04:55 +0900 Subject: [PATCH] =?UTF-8?q?Session=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95.=20-=20Session=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EB=82=B4=EC=97=90=EC=84=9C=20global=20setter,=20getter=20?= =?UTF-8?q?=EC=9E=AC=EC=A0=95=EC=9D=98=20-=20Session=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=EC=97=90=EC=84=9C=20static=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20getUserID,=20getUserGrade=20=EC=9E=AC=EC=A0=95?= =?UTF-8?q?=EC=9D=98=20-=20=EB=82=B4=EB=B6=80=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20getUserID,=20getUserGrade=EB=A5=BC=20?= =?UTF-8?q?=EC=93=B0=EB=8D=98=20=EA=B2=83=20Session=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=EB=A1=9C=20=ED=86=B5=EC=9D=BC=20-=20SESSION.php?= =?UTF-8?q?=EA=B0=80=20requireLogin=20=EA=B8=B0=EB=8A=A5=EC=9D=84=20?= =?UTF-8?q?=EC=88=98=ED=96=89=ED=95=98=EB=8D=98=EA=B2=83=EC=9D=84=20Sessio?= =?UTF-8?q?n=EC=9D=98=20static=20=ED=95=A8=EC=88=98=EB=A1=9C=20=ED=86=B5?= =?UTF-8?q?=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f_config/SESSION.php | 13 --- i_entrance/admin_userlist.php | 8 +- i_entrance/entrance.php | 4 +- i_entrance/j_change_password.php | 10 +- i_entrance/j_delete_me.php | 12 +-- i_entrance/j_get_user_info.php | 6 +- i_entrance/j_icon_change.php | 8 +- i_entrance/j_icon_delete.php | 8 +- i_entrance/j_logout.php | 4 +- i_entrance/j_server_change_status.php | 4 +- i_entrance/j_server_get_admin_status.php | 2 +- i_entrance/member/Get.php | 4 +- i_entrance/member/Post.php | 4 +- index.php | 4 +- j_login.php | 8 +- oauth_kakao/j_change_pw.php | 6 +- oauth_kakao/j_login_oauth.php | 8 +- src/sammo/Lock.php | 3 + src/sammo/Session.php | 130 +++++++++++++++++------ twe/_119.php | 2 +- twe/_119_b.php | 2 +- twe/_admin1.php | 2 +- twe/_admin1_submit.php | 2 +- twe/_admin2.php | 2 +- twe/_admin2_submit.php | 2 +- twe/_admin4.php | 2 +- twe/_admin4_submit.php | 2 +- twe/_admin5.php | 4 +- twe/_admin5_submit.php | 6 +- twe/_admin6.php | 2 +- twe/_admin7.php | 4 +- twe/_admin8.php | 4 +- twe/_simul.php | 4 +- twe/a_bestGeneral.php | 2 +- twe/a_genList.php | 2 +- twe/a_history.php | 2 +- twe/a_kingdomList.php | 2 +- twe/a_status.php | 2 +- twe/a_vote.php | 14 +-- twe/b_auction.php | 4 +- twe/b_battleCenter.php | 2 +- twe/b_betting.php | 4 +- twe/b_chiefboard.php | 2 +- twe/b_chiefcenter.php | 2 +- twe/b_currentCity.php | 6 +- twe/b_dipcenter.php | 2 +- twe/b_diplomacy.php | 6 +- twe/b_genList.php | 2 +- twe/b_myBossInfo.php | 2 +- twe/b_myCityInfo.php | 4 +- twe/b_myGenInfo.php | 2 +- twe/b_myKingdomInfo.php | 4 +- twe/b_myPage.php | 6 +- twe/b_nationboard.php | 2 +- twe/b_nationrule.php | 2 +- twe/b_tournament.php | 4 +- twe/b_troop.php | 2 +- twe/c_auction.php | 4 +- twe/c_betting.php | 4 +- twe/c_chiefboard.php | 2 +- twe/c_dipcenter.php | 2 +- twe/c_double.php | 12 +-- twe/c_myBossInfo.php | 2 +- twe/c_nationboard.php | 2 +- twe/c_nationrule.php | 2 +- twe/c_tournament.php | 46 ++++---- twe/c_troop.php | 2 +- twe/c_vacation.php | 2 +- twe/c_vote.php | 6 +- twe/commandlist.php | 2 +- twe/d_ally.php | 2 +- twe/d_cancel.php | 2 +- twe/d_cease.php | 2 +- twe/d_merge.php | 2 +- twe/d_scout.php | 2 +- twe/d_surrender.php | 2 +- twe/event_1.php | 2 +- twe/event_2.php | 2 +- twe/event_3.php | 2 +- twe/event_4.php | 2 +- twe/func.php | 73 ++++--------- twe/func_command.php | 6 +- twe/func_legacy.php | 2 +- twe/func_message.php | 4 +- twe/index.php | 10 +- twe/install.php | 2 +- twe/j_adjust_icon.php | 2 +- twe/j_drop_settings.php | 2 +- twe/j_get_scenario_map.php | 5 +- twe/j_init_settings.php | 2 +- twe/j_msgsubmit.php | 2 +- twe/j_server_basic_info.php | 4 +- twe/join.php | 2 +- twe/join_post.php | 2 +- twe/login_process.php | 4 +- twe/old/install.php | 2 +- twe/old/install1.php | 2 +- twe/old/install2.php | 2 +- twe/old/j_old_install.php | 2 +- twe/old/j_old_install2.php | 2 +- twe/old/j_old_install3.php | 2 +- twe/preprocessing.php | 2 +- twe/processing.php | 76 ++++++------- twe/reset.php | 2 +- twe/select_npc.php | 2 +- twe/select_npc_post.php | 2 +- twe/selection.php | 2 +- twe/turn.php | 10 +- twe/turn_pop_core.php | 2 +- twe/turn_push_core.php | 2 +- 110 files changed, 367 insertions(+), 343 deletions(-) delete mode 100644 f_config/SESSION.php diff --git a/f_config/SESSION.php b/f_config/SESSION.php deleted file mode 100644 index 7ca6aa45..00000000 --- a/f_config/SESSION.php +++ /dev/null @@ -1,13 +0,0 @@ -isLoggedIn()) { - header ("Location: ".ROOT); - die(); -} - - diff --git a/i_entrance/admin_userlist.php b/i_entrance/admin_userlist.php index d8508f2b6..fecf45e4 100644 --- a/i_entrance/admin_userlist.php +++ b/i_entrance/admin_userlist.php @@ -3,15 +3,15 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -require_once(ROOT.'/f_config/SESSION.php'); +$session = Session::requireLogin(); $db = getRootDB(); -$userGrade = $SESSION->getGrade(); +$userGrade = $session->userGrade; -session_write_close(); +$session->setReadOnly(); if($userGrade < 6){ - header('Location:../'); + header('Location:'.ROOT); die(); } ?> diff --git a/i_entrance/entrance.php b/i_entrance/entrance.php index 3295a648..82e99dc1 100644 --- a/i_entrance/entrance.php +++ b/i_entrance/entrance.php @@ -3,13 +3,13 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -require_once(ROOT.'/f_config/SESSION.php'); +$session = Session::requireLogin(); $templates = new \League\Plates\Engine('templates'); $db = getRootDB(); $notice = $db->queryFirstField('SELECT `NOTICE` FROM `SYSTEM` WHERE `NO`=1'); -$userGrade = $SESSION->getGrade(); +$userGrade = $session->userGrade; ?> diff --git a/i_entrance/j_change_password.php b/i_entrance/j_change_password.php index 46e6b34e..82eb9167 100644 --- a/i_entrance/j_change_password.php +++ b/i_entrance/j_change_password.php @@ -4,9 +4,9 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -$SESSION = new Session(); +$session = Session::Instance(); -if(!$SESSION->isLoggedIn()) { +if(!$session->isLoggedIn()) { Json::die([ 'result'=>false, 'reason'=>'로그인되지 않았습니다.' @@ -27,11 +27,11 @@ $db = getRootDB(); $userInfo = $db->update('member',[ 'pw'=>$db->sqleval('sha2(concat(salt, %s, salt), 512)', $newPw) -], 'no=%i and pw=sha2(concat(salt, %s, salt), 512)', $SESSION->noMember(), $pw); +], 'no=%i and pw=sha2(concat(salt, %s, salt), 512)', $session->userID, $pw); if(!$db->affectedRows()){ $db->insert('member_log', [ - 'member_no'=>$SESSION->noMember(), + 'member_no'=>$session->userID, 'action_type'=>'change_pw', 'action'=>json_encode([ 'type'=>'plain', @@ -46,7 +46,7 @@ if(!$db->affectedRows()){ } $db->insert('member_log', [ - 'member_no'=>$SESSION->noMember(), + 'member_no'=>$session->userID, 'action_type'=>'change_pw', 'action'=>json_encode([ 'type'=>'plain', diff --git a/i_entrance/j_delete_me.php b/i_entrance/j_delete_me.php index a8f88882..73e7d58a 100644 --- a/i_entrance/j_delete_me.php +++ b/i_entrance/j_delete_me.php @@ -5,9 +5,9 @@ require_once('_common.php'); require_once(ROOT.'/f_func/class._Time.php'); require_once(ROOT.'/f_config/DB.php'); -$SESSION = new Session(); +$session = Session::Instance(); -if(!$SESSION->isLoggedIn()) { +if(!$session->isLoggedIn()) { Json::die([ 'result'=>false, 'reason'=>'로그인되지 않았습니다.' @@ -30,7 +30,7 @@ $db = getRootDB(); $userInfo = $db->queryFirstRow('SELECT oauth_id, oauth_type, email, delete_after FROM MEMBER '. 'WHERE `no`=%i and pw=sha2(concat(salt, %s, salt), 512)', - $SESSION->noMember(), $pw); + $session->userID, $pw); if(!$userInfo){ Json::die([ @@ -48,7 +48,7 @@ if($userInfo['delete_after']){ $db->update('member',[ 'delete_after'=>_Time::DatetimeFromNowMinute(60*24*30) -], 'no=%i', $SESSION->noMember()); +], 'no=%i', $session->userID); if(!$db->affectedRows()){ Json::die([ @@ -60,11 +60,11 @@ if(!$db->affectedRows()){ $db->insert('member_log', [ - 'member_no'=>$SESSION->noMember(), + 'member_no'=>$session->userID, 'action_type'=>'delete' ]); -$SESSION->logout(); +$session->logout(); unset($_SESSION['access_token']); setcookie("hello", "", time()-3600); diff --git a/i_entrance/j_get_user_info.php b/i_entrance/j_get_user_info.php index 49848764..f6da4e0b 100644 --- a/i_entrance/j_get_user_info.php +++ b/i_entrance/j_get_user_info.php @@ -4,9 +4,9 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -$SESSION = new Session(); +$session = Session::Instance(); -if(!$SESSION->isLoggedIn()) { +if(!$session->isLoggedIn()) { Json::die([ 'result'=>false, 'reason'=>'로그인되지 않았습니다.' @@ -16,7 +16,7 @@ if(!$SESSION->isLoggedIn()) { // 외부 파라미터 $db = getRootDB(); -$member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture` FROM `MEMBER` WHERE `NO` = %i', $SESSION->noMember()); +$member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture` FROM `MEMBER` WHERE `NO` = %i', $session->userID); if(!$member['picture']){ $picture = IMAGE.'/default.jpg'; diff --git a/i_entrance/j_icon_change.php b/i_entrance/j_icon_change.php index e796414c..ffc180f9 100644 --- a/i_entrance/j_icon_change.php +++ b/i_entrance/j_icon_change.php @@ -4,9 +4,9 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -$SESSION = new Session(); +$session = Session::Instance(); -if(!$SESSION->isLoggedIn()) { +if(!$session->isLoggedIn()) { Json::die([ 'result'=>false, 'reason'=>'로그인되지 않았습니다.' @@ -29,7 +29,7 @@ $imageType = $size[2]; $availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF); $db = getRootDB(); -$member = $db->queryFirstRow('SELECT `ID`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->noMember()); +$member = $db->queryFirstRow('SELECT `ID`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $session->userID); $picName = $member['PICTURE']; @@ -87,7 +87,7 @@ if(!is_uploaded_file($image['tmp_name'])) { getRootDB()->update('MEMBER',[ 'PICTURE' => $pic, 'IMGSVR' => 1 - ], 'NO=%i', $SESSION->noMember()); + ], 'NO=%i', $session->userID); $servers = []; diff --git a/i_entrance/j_icon_delete.php b/i_entrance/j_icon_delete.php index 9dbc0e65..f9da4a7d 100644 --- a/i_entrance/j_icon_delete.php +++ b/i_entrance/j_icon_delete.php @@ -4,9 +4,9 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -$SESSION = new Session(); +$session = Session::Instance(); -if(!$SESSION->isLoggedIn()) { +if(!$session->isLoggedIn()) { Json::die([ 'result'=>false, 'reason'=>'로그인되지 않았습니다.' @@ -17,7 +17,7 @@ if(!$SESSION->isLoggedIn()) { $respone = []; $db = getRootDB(); -$picName = $db->queryFirstField('SELECT picture FROM `MEMBER` WHERE `NO` = %i', $SESSION->noMember()); +$picName = $db->queryFirstField('SELECT picture FROM `MEMBER` WHERE `NO` = %i', $session->userID); if($picName && strlen($picName) > 11){ $dt = substr($picName, -8); @@ -42,7 +42,7 @@ if($dt == $rf) { $db->update('MEMBER', [ 'PICTURE'=>'default.jpg', 'IMGSVR'=>0, - ], 'NO=%i', $SESSION->noMember()); + ], 'NO=%i', $session->userID); $servers = []; diff --git a/i_entrance/j_logout.php b/i_entrance/j_logout.php index ae931fd9..fc02c9fb 100644 --- a/i_entrance/j_logout.php +++ b/i_entrance/j_logout.php @@ -3,12 +3,12 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -require_once(ROOT.'/f_config/SESSION.php'); +$session = Session::requireLogin(); // 외부 파라미터 -$SESSION->logout(); +$session->logout(); unset($_SESSION['access_token']); session_write_close(); setcookie("hello", "", time()-3600); diff --git a/i_entrance/j_server_change_status.php b/i_entrance/j_server_change_status.php index 395a7e49..06ae2ba6 100644 --- a/i_entrance/j_server_change_status.php +++ b/i_entrance/j_server_change_status.php @@ -3,7 +3,7 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -require_once(ROOT.'/f_config/SESSION.php'); +$session = Session::requireLogin(); @@ -21,7 +21,7 @@ $notice = util::array_get($_POST['notice'], ''); $server = util::array_get($_POST['server'], ''); $db = getRootDB(); -$userGrade = $SESSION->getGrade(); +$userGrade = $session->userGrade; session_write_close(); if($userGrade < 6) { diff --git a/i_entrance/j_server_get_admin_status.php b/i_entrance/j_server_get_admin_status.php index 4953c283..b78577b4 100644 --- a/i_entrance/j_server_get_admin_status.php +++ b/i_entrance/j_server_get_admin_status.php @@ -5,7 +5,7 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -require_once(ROOT.'/f_config/SESSION.php'); +$session = Session::requireLogin(); $result = []; diff --git a/i_entrance/member/Get.php b/i_entrance/member/Get.php index 084fc0f1..6beaa7a5 100644 --- a/i_entrance/member/Get.php +++ b/i_entrance/member/Get.php @@ -3,7 +3,7 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -require_once(ROOT.'/f_config/SESSION.php'); +$session = Session::requireLogin(); @@ -12,7 +12,7 @@ require_once(ROOT.'/f_config/SESSION.php'); $select = $_GET['select']; $db = getRootDB(); -$userGrade = $SESSION->getGrade(); +$userGrade = $session->userGrade; if($userGrade < 6) { Json::die([ 'result'=>'FAIL', diff --git a/i_entrance/member/Post.php b/i_entrance/member/Post.php index 8fb00c5b..09df36dd 100644 --- a/i_entrance/member/Post.php +++ b/i_entrance/member/Post.php @@ -3,7 +3,7 @@ namespace sammo; require_once('_common.php'); require_once(ROOT.'/f_config/DB.php'); -require_once(ROOT.'/f_config/SESSION.php'); +$session = Session::requireLogin(); // 외부 파라미터 // $_POST['select'] : 처리종류 @@ -12,7 +12,7 @@ $select = $_POST['select']; $no = $_POST['no']; $db = getRootDB(); -$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->noMember()); +$member = $db->queryFirstRow('SELECT `GRADE` FROM `MEMBER` WHERE `NO` = %i', $session->userID); if($member['GRADE'] < 6) { $response['result'] = 'FAIL'; diff --git a/index.php b/index.php index c24e449f..2baae005 100644 --- a/index.php +++ b/index.php @@ -13,12 +13,12 @@ if(!$SETTING->isExists()){ require(ROOT.'/f_config/DB.php'); -$SESSION = new _SESSION(); +$session = Session::Instance(); use \kakao\KakaoKey as KakaoKey; -if($SESSION->isLoggedIn()){ +if($session->isLoggedIn()){ header ('Location:i_entrance/entrance.php'); die(); } diff --git a/j_login.php b/j_login.php index 63e0e710..da4b04cf 100644 --- a/j_login.php +++ b/j_login.php @@ -8,9 +8,9 @@ require_once(ROOT.'/f_config/DB.php'); -$SESSION = new Session(); -if($SESSION->isLoggedIn()){ - $SESSION->logout(); +$session = Session::Instance(); +if($session->isLoggedIn()){ + $session->logout(); } $username = mb_strtolower(util::array_get($_POST['username']), 'utf-8'); @@ -64,7 +64,7 @@ if($userInfo['delete_after']){ } -$SESSION->login($userInfo['no'], $userInfo['id'], $userInfo['grade']); +$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade']); Json::die([ 'result'=>true, 'reason'=>'로그인 되었습니다.' diff --git a/oauth_kakao/j_change_pw.php b/oauth_kakao/j_change_pw.php index f8acd449..d6f737fb 100644 --- a/oauth_kakao/j_change_pw.php +++ b/oauth_kakao/j_change_pw.php @@ -10,14 +10,14 @@ use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; $nowDate = _Time::DatetimeNow(); -$SESSION = new Session(); -if(!$SESSION->isLoggedIn()){ +$session = Session::Instance(); +if(!$session->isLoggedIn()){ Json::die([ 'result'=>false, 'reason'=>'로그인이 되어있지 않습니다' ]); } -$userID = $SESSION->noMember(); +$userID = $session->userID; $access_token = util::array_get($_SESSION['access_token']); $expires = util::array_get($_SESSION['expires']); $refresh_token = util::array_get($_SESSION['refresh_token']); diff --git a/oauth_kakao/j_login_oauth.php b/oauth_kakao/j_login_oauth.php index f554707e..d87db3e9 100644 --- a/oauth_kakao/j_login_oauth.php +++ b/oauth_kakao/j_login_oauth.php @@ -9,9 +9,9 @@ require('kakao.php'); use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; -$SESSION = new Session(); -if($SESSION->isLoggedIn()){ - $SESSION->logout(); +$session = Session::Instance(); +if($session->isLoggedIn()){ + $session->logout(); } $canLogin = getRootDB()->queryFirstField('SELECT `LOGIN` FROM `SYSTEM` WHERE `NO` = 1'); @@ -126,7 +126,7 @@ if($userInfo['delete_after']){ } -$SESSION->login($userInfo['no'], $userInfo['id'], $userInfo['grade']); +$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade']); Json::die([ 'result'=>true, 'reason'=>'로그인 되었습니다.' diff --git a/src/sammo/Lock.php b/src/sammo/Lock.php index 36fcc213..72e5c6d6 100644 --- a/src/sammo/Lock.php +++ b/src/sammo/Lock.php @@ -1,6 +1,9 @@ true, + 'time'=>true, + 'userID'=>true, + 'userName'=>true, + 'userGrade'=>true, + 'writeClosed'=>true + ]; + + private $writeClosed = false; + + /** + * @return \sammo\Session + */ + public static function Instance(){ + static $inst = null; + if($inst === null){ + $inst = new Session(); + } + return $inst; + } + + /** + * @return \sammo\Session + */ + public static function requireLogin(string $path = ROOT){ + $session = Session::Instance(); + if(!$session->isLoggedIn()){ + header('Location:'.$path); + die(); + } + return $session; + } + public function __construct() { //session_cache_limiter('nocache, must_revalidate'); @@ -21,52 +56,91 @@ class Session { } } - public function writeClose(){ - session_write_close(); + /** + * @return \sammo\Session + */ + public function setReadOnly(){ + if(!$this->writeClosed){ + session_write_close(); + $this->writeClosed = true; + } + return $this; } public function __set(string $name, mixed $value){ + if(key_exists($key, self::PROTECED_NAMES)){ + trigger_error("{$name}은 외부에서 쓰기 금지된 Session 변수입니다.", E_USER_NOTICE); + return; + } + + $this->set($name, $value); + } + + private function set(string $name, mixed $value){ if($value === null){ unset($_SESSION[$name]); } else{ $_SESSION[$name] = $value; } - } public function __get(string $name){ + return $this->get($name); + } + + private function get(string $name){ return util::array_get($_SESSION[$name]); } - public function set($key, $val) { - $_SESSION[$key] = $val; - } - - public function get($key) { - return util::array_get($_SESSION[$key]); - } - - public function login($noMember, $idMember, $grade) { - $_SESSION['noMember'] = $noMember; - $_SESSION['p_id'] = $idMember; - $_SESSION['ip'] = util::get_client_ip(true); - $_SESSION['time'] = time(); - $_SESSION['userGrade'] = $grade; + public function login(int $userID, string $userName, int $grade) { + $this->set('userID', $userID); + $this->set('userName', $userName); + $this->set('ip', util::get_client_ip(true)); + $this->set('time', time()); + $this->set('userGrade', $grade); } public function logout() { - unset($_SESSION['noMember']); - unset($_SESSION['p_id']); - unset($_SESSION['userGrade']); + $this->set('userID', null); + $this->set('userName', null); + $this->set('userGrade', null); + $this->set('time', time()); } - public function getGrade() { - return $_SESSION['userGrade']; + /** + * 로그인 유저의 전역 grade를 받아옴 + * @return int|null + */ + public static function getUserGrade(bool $requireLogin = false, string $exitPath = ROOT){ + if($requireLogin){ + $obj = self::requireLogin($exitPath); + } + else{ + $obj = self::Instance(); + } + + return $obj->userGrade; + } + + /** + * 로그인한 유저의 전역 id(숫자)를 받아옴 + * + * @return int|null + */ + public static function getUserID(bool $requireLogin = false, string $exitPath = ROOT){ + if($requireLogin){ + $obj = self::requireLogin($exitPath); + } + else{ + $obj = self::Instance(); + } + + return $obj->userID; } public function isLoggedIn() { - if($this->noMember()){ + if($this->userID){ return true; } else{ @@ -74,10 +148,6 @@ class Session { } } - public function noMember() { - return $this->get('noMember'); - } - public function __destruct() { } } diff --git a/twe/_119.php b/twe/_119.php index 27195d82..44d592ba 100644 --- a/twe/_119.php +++ b/twe/_119.php @@ -6,7 +6,7 @@ include "func.php"; $connect=dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_119_b.php b/twe/_119_b.php index b7800f15..cad7853a 100644 --- a/twe/_119_b.php +++ b/twe/_119_b.php @@ -6,7 +6,7 @@ include "func.php"; $connect=dbConn(); -if(getUserGrade() < 5){ +if(Session::getUserGrade() < 5){ //echo ""; echo '_119.php';//TODO:debug all and replace } diff --git a/twe/_admin1.php b/twe/_admin1.php index 27d6fc0c..afed8679 100644 --- a/twe/_admin1.php +++ b/twe/_admin1.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_admin1_submit.php b/twe/_admin1_submit.php index 6115a6b6..8030fd10 100644 --- a/twe/_admin1_submit.php +++ b/twe/_admin1_submit.php @@ -9,7 +9,7 @@ $connect = dbConn(); $admin = getAdmin($connect); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { //echo ""; echo '_admin1.php';//TODO:debug all and replace } diff --git a/twe/_admin2.php b/twe/_admin2.php index abe8e636..ba5856f6 100644 --- a/twe/_admin2.php +++ b/twe/_admin2.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_admin2_submit.php b/twe/_admin2_submit.php index 3e1a58e2..da9ca470 100644 --- a/twe/_admin2_submit.php +++ b/twe/_admin2_submit.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { //echo ""; echo '_admin2.php';//TODO:debug all and replace } diff --git a/twe/_admin4.php b/twe/_admin4.php index c0d14f3f..a902294b 100644 --- a/twe/_admin4.php +++ b/twe/_admin4.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_admin4_submit.php b/twe/_admin4_submit.php index 64a0ddfa..78b1ffd8 100644 --- a/twe/_admin4_submit.php +++ b/twe/_admin4_submit.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { //echo ""; echo '_admin4.php';//TODO:debug all and replace } diff --git a/twe/_admin5.php b/twe/_admin5.php index ffa19f83..36d1af97 100644 --- a/twe/_admin5.php +++ b/twe/_admin5.php @@ -7,11 +7,11 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select skin from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_admin5_submit.php b/twe/_admin5_submit.php index 8a87f476..63730443 100644 --- a/twe/_admin5_submit.php +++ b/twe/_admin5_submit.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { //echo ""; echo '_admin5.php';//TODO:debug all and replace } @@ -15,10 +15,10 @@ if(getUserGrade() < 5) { switch($btn) { case "국가변경": if($nation == 0) { - $query = "update general set nation=0,level=0 where owner='{$_SESSION['noMember']}'"; + $query = "update general set nation=0,level=0 where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } else { - $query = "update general set nation='{$nation}',level=1 where owner='{$_SESSION['noMember']}'"; + $query = "update general set nation='{$nation}',level=1 where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } break; diff --git a/twe/_admin6.php b/twe/_admin6.php index fcda6126..86565b63 100644 --- a/twe/_admin6.php +++ b/twe/_admin6.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_admin7.php b/twe/_admin7.php index 34c4efa6..af7d6c3c 100644 --- a/twe/_admin7.php +++ b/twe/_admin7.php @@ -7,11 +7,11 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select skin from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_admin8.php b/twe/_admin8.php index ba61fb96..eadd878e 100644 --- a/twe/_admin8.php +++ b/twe/_admin8.php @@ -7,11 +7,11 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select skin from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/_simul.php b/twe/_simul.php index f4a05b61..b56f7baf 100644 --- a/twe/_simul.php +++ b/twe/_simul.php @@ -50,7 +50,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("시뮬", 2); -$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -61,7 +61,7 @@ $game = MYDB_fetch_array($result); $con = checkLimit($me['con'], $game['conlimit']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } -if(getUserGrade() < 3) { +if(Session::getUserGrade() < 3) { echo "특별회원이 아닙니다."; exit(); } diff --git a/twe/a_bestGeneral.php b/twe/a_bestGeneral.php index 046b026b..1a3decc8 100644 --- a/twe/a_bestGeneral.php +++ b/twe/a_bestGeneral.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select con,turntime from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/a_genList.php b/twe/a_genList.php index 627f3c12..5db3160b 100644 --- a/twe/a_genList.php +++ b/twe/a_genList.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select con,turntime from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/a_history.php b/twe/a_history.php index f41379e9..860696eb 100644 --- a/twe/a_history.php +++ b/twe/a_history.php @@ -13,7 +13,7 @@ $query = "select startyear,year,month,conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,map,con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,map,con,turntime from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/a_kingdomList.php b/twe/a_kingdomList.php index 34f80b15..7c0fe91c 100644 --- a/twe/a_kingdomList.php +++ b/twe/a_kingdomList.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select con,turntime from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/a_status.php b/twe/a_status.php index 551f4f3f..23ee2733 100644 --- a/twe/a_status.php +++ b/twe/a_status.php @@ -13,7 +13,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,map,con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,map,con,turntime from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/a_vote.php b/twe/a_vote.php index d1ebd7e5..e7f94f36 100644 --- a/twe/a_vote.php +++ b/twe/a_vote.php @@ -6,7 +6,7 @@ include "func.php"; $connect = dbConn(); increaseRefresh("설문조사", 1); -$query = "select no,vote from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,vote from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -46,7 +46,7 @@ function captureKey(e) { 설 문 조 사 (금과 추첨으로 유니크템 증정!) = 5) { +if(Session::getUserGrade() >= 5) { echo " @@ -85,7 +85,7 @@ for($i=1; $i < $voteTypeCount; $i++) { echo " "; - } elseif($admin['voteopen'] >= 1 || getUserGrade() >= 5) { + } elseif($admin['voteopen'] >= 1 || Session::getUserGrade() >= 5) { $query = "select no from general where vote='{$i}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $vCount = MYDB_num_rows($result); @@ -121,7 +121,7 @@ echo " "; -if(getUserGrade() >= 5) { +if(Session::getUserGrade() >= 5) { echo " @@ -173,7 +173,7 @@ if($me['no'] > 0) { 전 체 통 계 = 5) { +if(Session::getUserGrade() >= 5) { echo " @@ -182,7 +182,7 @@ if(getUserGrade() >= 5) { echo " "; -if($admin['voteopen'] >= 1 || getUserGrade() >= 5) { +if($admin['voteopen'] >= 1 || Session::getUserGrade() >= 5) { echo " 전 체 @@ -223,7 +223,7 @@ if($admin['voteopen'] >= 1 || getUserGrade() >= 5) { "; } -if($admin['voteopen'] >= 2 || getUserGrade() >= 5) { +if($admin['voteopen'] >= 2 || Session::getUserGrade() >= 5) { $query = "select no from general where nation=0 and npc<2"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $memCount = MYDB_num_rows($result); diff --git a/twe/b_auction.php b/twe/b_auction.php index 70d39471..b0bea602 100644 --- a/twe/b_auction.php +++ b/twe/b_auction.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("거래장", 2); -$query = "select no,special,skin,con,turntime from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,special,skin,con,turntime from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -29,7 +29,7 @@ $bidCount = MYDB_num_rows($result); $btCount = $tradeCount + $bidCount; -if(getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { +if(Session::getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { $btn = "submit"; } else { $btn = "hidden"; diff --git a/twe/b_battleCenter.php b/twe/b_battleCenter.php index 3ad6ff00..b3b536f6 100644 --- a/twe/b_battleCenter.php +++ b/twe/b_battleCenter.php @@ -18,7 +18,7 @@ $query = "select nation from general where no='$gen'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_betting.php b/twe/b_betting.php index 6bd040cf..c809ac83 100644 --- a/twe/b_betting.php +++ b/twe/b_betting.php @@ -9,7 +9,7 @@ $connect = dbConn(); increaseRefresh("베팅장", 1); checkTurn($connect); -$query = "select no,tournament,con,turntime,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,tournament,con,turntime,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -194,7 +194,7 @@ for($i=0; $i < 16; $i++) { echo "{$gen[$i]}"; } -$query = "select bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15 from general where owner='{$_SESSION['noMember']}'"; +$query = "select bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15 from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); for($i=0; $i < 16; $i++) { diff --git a/twe/b_chiefboard.php b/twe/b_chiefboard.php index 188a4b4b..b2207f9e 100644 --- a/twe/b_chiefboard.php +++ b/twe/b_chiefboard.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("기밀실", 1); -$query = "select skin,no,nation,level from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_chiefcenter.php b/twe/b_chiefcenter.php index 9a10f92a..335a8aef 100644 --- a/twe/b_chiefcenter.php +++ b/twe/b_chiefcenter.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_currentCity.php b/twe/b_currentCity.php index 78031d73..d2bb4be0 100644 --- a/twe/b_currentCity.php +++ b/twe/b_currentCity.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("현재도시", 1); -$query = "select skin,no,nation,level,city from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -132,7 +132,7 @@ echo "
"; // 첩보된 도시까지만 허용 -if($valid == 0 && getUserGrade() < 5) { +if($valid == 0 && Session::getUserGrade() < 5) { $_REQUEST['citylist'] = $me['city']; } @@ -283,7 +283,7 @@ for($j=0; $j < $gencount; $j++) { $intel ".getLevel($general['level']).""; //아국장수이거나 보는 사람이 운영자일때 보여줌 - if(($general['nation'] != 0 && $general['nation'] == $myNation['nation']) || getUserGrade() >= 5) { + if(($general['nation'] != 0 && $general['nation'] == $myNation['nation']) || Session::getUserGrade() >= 5) { switch($general['mode']) { case 0: $mode = "×"; break; case 1: $mode = "○"; break; diff --git a/twe/b_dipcenter.php b/twe/b_dipcenter.php index 26859e18..375d48da 100644 --- a/twe/b_dipcenter.php +++ b/twe/b_dipcenter.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_diplomacy.php b/twe/b_diplomacy.php index 1e913e62..5f08240f 100644 --- a/twe/b_diplomacy.php +++ b/twe/b_diplomacy.php @@ -12,7 +12,7 @@ $query = "select turnterm from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,nation,skin,map from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,nation,skin,map from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -117,7 +117,7 @@ for($i=0; $i < $nationcount; $i++) { case 0: $str = ""; break; case 1: $str = ""; break; case 2: - if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || getUserGrade() >= 5) { $str = "ㆍ"; } + if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || Session::getUserGrade() >= 5) { $str = "ㆍ"; } else { $str = "?"; } // $str = "ㆍ"; break; @@ -126,7 +126,7 @@ for($i=0; $i < $nationcount; $i++) { case 5: $str = ""; break; case 6: $str = ""; break; case 7: - if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || getUserGrade() >= 5) { $str = "@"; } + if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || Session::getUserGrade() >= 5) { $str = "@"; } else { $str = "?"; } // $str = "@"; break; diff --git a/twe/b_genList.php b/twe/b_genList.php index 85ab2c2e..7989bf01 100644 --- a/twe/b_genList.php +++ b/twe/b_genList.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_myBossInfo.php b/twe/b_myBossInfo.php index b522df83..4cff5e59 100644 --- a/twe/b_myBossInfo.php +++ b/twe/b_myBossInfo.php @@ -10,7 +10,7 @@ increaseRefresh("인사부", 1); //훼섭 추방을 위해 갱신 checkTurn($connect); -$query = "select skin,no,nation,level from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_myCityInfo.php b/twe/b_myCityInfo.php index 95aee7a0..7395aa43 100644 --- a/twe/b_myCityInfo.php +++ b/twe/b_myCityInfo.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("세력도시", 1); -$query = "select no,nation,level,skin from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,nation,level,skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -59,7 +59,7 @@ if($me['skin'] < 1) {
0) { $submit = 'hidden'; } - $query = "update general set myset=myset-1,map='$map',mode='$mode',skin='$skin',tnmt='$tnmt' where owner='{$_SESSION['noMember']}'"; + $query = "update general set myset=myset-1,map='$map',mode='$mode',skin='$skin',tnmt='$tnmt' where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -$query = "select no,skin,map,mode,tnmt,myset from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,skin,map,mode,tnmt,myset from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_nationboard.php b/twe/b_nationboard.php index bab02e26..5ec93a56 100644 --- a/twe/b_nationboard.php +++ b/twe/b_nationboard.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("회의실", 1); -$query = "select skin,no,nation from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/b_nationrule.php b/twe/b_nationrule.php index 0dc7991e..4f1ab938 100644 --- a/twe/b_nationrule.php +++ b/twe/b_nationrule.php @@ -23,7 +23,7 @@ increaseRefresh("국법", 1); = 5) { +if(Session::getUserGrade() >= 5) { echo " diff --git a/twe/b_troop.php b/twe/b_troop.php index 81a0be1f..747d70e0 100644 --- a/twe/b_troop.php +++ b/twe/b_troop.php @@ -8,7 +8,7 @@ CheckLogin(); $connect = dbConn(); increaseRefresh("부대편성", 1); -$query = "select skin,no,nation,troop from general where owner='{$_SESSION['noMember']}'"; +$query = "select skin,no,nation,troop from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/c_auction.php b/twe/c_auction.php index 8e06a05a..04d05fa2 100644 --- a/twe/c_auction.php +++ b/twe/c_auction.php @@ -12,7 +12,7 @@ $query = "select turnterm from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,gold,rice,special from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,gold,rice,special from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -44,7 +44,7 @@ $value = round($value / 10) * 10; if($term > 24) $term = 24; $valid = 1; -if(getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { +if(Session::getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { } else { $msg = "ㆍ더이상 등록할 수 없습니다."; $msg2 = "ㆍ더이상 등록할 수 없습니다."; diff --git a/twe/c_betting.php b/twe/c_betting.php index 120ab099..f2af9f1e 100644 --- a/twe/c_betting.php +++ b/twe/c_betting.php @@ -22,7 +22,7 @@ if($admin['tournament'] != 6) { exit(); } -$query = "select gold,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['noMember']}'"; +$query = "select gold,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -32,7 +32,7 @@ for($i=0; $i < 16; $i++) { $mebet = $me["bet{$i}"]; if($gold >= 10 && $gold <= 1000) { if($gold + 500 <= $me['gold'] && $gold + $mebet <= 1000 && $gold + $me['bet'] <= 1000) { - $query = "update general set gold=gold-'$gold',bet{$i}=bet{$i}+'$gold',betgold=betgold+'$gold' where owner='{$_SESSION['noMember']}'"; + $query = "update general set gold=gold-'$gold',bet{$i}=bet{$i}+'$gold',betgold=betgold+'$gold' where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $query = "update game set bet{$i}=bet{$i}+'$gold' where no='1'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/twe/c_chiefboard.php b/twe/c_chiefboard.php index 6f81912a..c9011c96 100644 --- a/twe/c_chiefboard.php +++ b/twe/c_chiefboard.php @@ -10,7 +10,7 @@ CheckLogin(); $connect = dbConn(); if(getBlockLevel() != 1 && getBlockLevel() != 3) { - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/c_dipcenter.php b/twe/c_dipcenter.php index a46ba4a1..7d9455fa 100644 --- a/twe/c_dipcenter.php +++ b/twe/c_dipcenter.php @@ -9,7 +9,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select no,nation,level from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/c_double.php b/twe/c_double.php index 74d894ac..640be8fb 100644 --- a/twe/c_double.php +++ b/twe/c_double.php @@ -32,7 +32,7 @@ if($command == 46) { if($name == "") { $name = "무명"; } $name = _String::SubStrForWidth($name, 0, 12); - $query = "update general set makenation='{$name}' where owner='{$_SESSION['noMember']}'"; + $query = "update general set makenation='{$name}' where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $count = sizeof($turn); @@ -40,13 +40,13 @@ if($command == 46) { for($i=0; $i < $count; $i++) { $str .= ",turn{$turn[$i]}='{$comStr}'"; } - $query = "update general set {$str} where owner='{$_SESSION['noMember']}'"; + $query = "update general set {$str} where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //echo ""; echo 'index.php';//TODO:debug all and replace //통합제의 } elseif($command == 53) { - $query = "select nation,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -73,7 +73,7 @@ if($command == 46) { echo 'b_chiefcenter.php';//TODO:debug all and replace //불가침 } elseif($command == 61) { - $query = "select nation,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -102,7 +102,7 @@ if($command == 46) { //백성동원, 수몰, 허보, 피장파장, 의병모집, 이호경식, 급습 //국기변경 } elseif($command == 23 || $command == 24 || $command == 27 || $command == 51 || $command == 52 || $command > 60) { - $query = "select no,nation,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -125,7 +125,7 @@ if($command == 46) { for($i=0; $i < $count; $i++) { $str .= ",turn{$turn[$i]}='{$comStr}'"; } - $query = "update general set {$str} where owner='{$_SESSION['noMember']}'"; + $query = "update general set {$str} where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //echo ""; echo 'index.php';//TODO:debug all and replace diff --git a/twe/c_myBossInfo.php b/twe/c_myBossInfo.php index 2b2c18aa..f6ed74d2 100644 --- a/twe/c_myBossInfo.php +++ b/twe/c_myBossInfo.php @@ -13,7 +13,7 @@ $query = "select startyear,year,month from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,nation,level from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); $meLevel = $me['level']; diff --git a/twe/c_nationboard.php b/twe/c_nationboard.php index 310fb45c..605cbbf3 100644 --- a/twe/c_nationboard.php +++ b/twe/c_nationboard.php @@ -10,7 +10,7 @@ CheckLogin(); $connect = dbConn(); if(getBlockLevel() != 1 && getBlockLevel() != 3) { - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/c_nationrule.php b/twe/c_nationrule.php index feb42734..2345d648 100644 --- a/twe/c_nationrule.php +++ b/twe/c_nationrule.php @@ -9,7 +9,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/c_tournament.php b/twe/c_tournament.php index 1920377a..a9a51a8f 100644 --- a/twe/c_tournament.php +++ b/twe/c_tournament.php @@ -13,7 +13,7 @@ $query = "select tournament,phase,tnmt_type,develcost from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,tournament from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,tournament from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -24,17 +24,17 @@ case 2: $tp = "power"; $tp2 = "일기토"; $tp3 = "power"; break; case 3: $tp = "intel"; $tp2 = "설전"; $tp3 = "intel"; break; } -if($me['tournament'] == 1 && getUserGrade() < 5) { echo ""; exit(); } +if($me['tournament'] == 1 && Session::getUserGrade() < 5) { echo ""; exit(); } -if($btn == "자동개최설정" && getUserGrade() >= 5) { +if($btn == "자동개최설정" && Session::getUserGrade() >= 5) { $query = "update game set tnmt_trig={$trig}"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "개최" && getUserGrade() >= 5) { +} elseif($btn == "개최" && Session::getUserGrade() >= 5) { startTournament($connect, $auto, $type); -} elseif($btn == "중단" && getUserGrade() >= 5) { +} elseif($btn == "중단" && Session::getUserGrade() >= 5) { $query = "update game set tnmt_auto=0, tournament=0, phase=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif((($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") && getUserGrade() >= 5) || $btn == "참가") { +} elseif((($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") && Session::getUserGrade() >= 5) || $btn == "참가") { if($btn == "투입") { $query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='$gen'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -125,7 +125,7 @@ if($btn == "자동개최설정" && getUserGrade() >= 5) { $query = "update game set tournament=2, phase=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -} elseif(($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") && getUserGrade() >= 5) { +} elseif(($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") && Session::getUserGrade() >= 5) { $z = 0; for($i=0; $i < 8; $i++) { $query = "select grp from tournament where grp='$i'"; @@ -179,25 +179,25 @@ if($btn == "자동개최설정" && getUserGrade() >= 5) { $query = "update game set tournament=2, phase=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "무명전부투입" && getUserGrade() >= 5) { fillLowGenAll($connect); -} elseif($btn == "예선" && getUserGrade() >= 5) { qualify($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "예선전부" && getUserGrade() >= 5) { qualifyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "추첨" && getUserGrade() >= 5) { selection($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "추첨전부" && getUserGrade() >= 5) { selectionAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "본선" && getUserGrade() >= 5) { finallySingle($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "본선전부" && getUserGrade() >= 5) { finallyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "배정" && getUserGrade() >= 5) { final16set($connect); -} elseif($btn == "베팅마감" && getUserGrade() >= 5) { +} elseif($btn == "무명전부투입" && Session::getUserGrade() >= 5) { fillLowGenAll($connect); +} elseif($btn == "예선" && Session::getUserGrade() >= 5) { qualify($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "예선전부" && Session::getUserGrade() >= 5) { qualifyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "추첨" && Session::getUserGrade() >= 5) { selection($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "추첨전부" && Session::getUserGrade() >= 5) { selectionAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "본선" && Session::getUserGrade() >= 5) { finallySingle($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "본선전부" && Session::getUserGrade() >= 5) { finallyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "배정" && Session::getUserGrade() >= 5) { final16set($connect); +} elseif($btn == "베팅마감" && Session::getUserGrade() >= 5) { $dt = date("Y-m-d H:i:s", time() + 60); $query = "update game set tournament='7',phase='0',tnmt_time='$dt' where no=1"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -} elseif($btn == "16강" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16); -} elseif($btn == "8강" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8); -} elseif($btn == "4강" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4); -} elseif($btn == "결승" && getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2); -} elseif($btn == "포상" && getUserGrade() >= 5) { setGift($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); -} elseif($btn == "회수" && getUserGrade() >= 5) { setRefund($connect); -} elseif($btn == "메시지" && getUserGrade() >= 5) { +} elseif($btn == "16강" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16); +} elseif($btn == "8강" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8); +} elseif($btn == "4강" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4); +} elseif($btn == "결승" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2); +} elseif($btn == "포상" && Session::getUserGrade() >= 5) { setGift($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); +} elseif($btn == "회수" && Session::getUserGrade() >= 5) { setRefund($connect); +} elseif($btn == "메시지" && Session::getUserGrade() >= 5) { $msg = addslashes(SQ2DQ($msg)); $query = "update game set tnmt_msg='$msg'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/twe/c_troop.php b/twe/c_troop.php index 63858180..809e089e 100644 --- a/twe/c_troop.php +++ b/twe/c_troop.php @@ -9,7 +9,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select no,nation,troop from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,nation,troop from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/c_vacation.php b/twe/c_vacation.php index f8700970..c9bd16ea 100644 --- a/twe/c_vacation.php +++ b/twe/c_vacation.php @@ -13,7 +13,7 @@ $admin = MYDB_fetch_array($result); $admin['killturn'] *= 3; -$query = "update general set killturn='{$admin['killturn']}' where owner='{$_SESSION['noMember']}'"; +$query = "update general set killturn='{$admin['killturn']}' where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //echo ""; diff --git a/twe/c_vote.php b/twe/c_vote.php index 8fa797ff..e95407c2 100644 --- a/twe/c_vote.php +++ b/twe/c_vote.php @@ -11,13 +11,13 @@ $query = "select develcost,vote,votecomment from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,vote,name,nation,horse,weap,book,item,npc from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,vote,name,nation,horse,weap,book,item,npc from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); if($btn == "투표" && $me['vote'] == 0 && $sel > 0) { $develcost = $admin['develcost'] * 5; - $query = "update general set gold=gold+{$develcost},vote='{$sel}' where owner='{$_SESSION['noMember']}'"; + $query = "update general set gold=gold+{$develcost},vote='{$sel}' where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $log = array(); @@ -45,7 +45,7 @@ else if($btn == "댓글" && $comment != "") { } -if(getUserGrade() < 5){ +if(Session::getUserGrade() < 5){ echo " echo 'a_vote.php '; die(); diff --git a/twe/commandlist.php b/twe/commandlist.php index 74abcbb4..2d1adbd0 100644 --- a/twe/commandlist.php +++ b/twe/commandlist.php @@ -67,7 +67,7 @@ function myCommandList($connect) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,turntime,term,turn0,turn1,turn2,turn3,turn4,turn5,turn6,turn7,turn8,turn9,turn10,turn11,turn12,turn13,turn14,turn15,turn16,turn17,turn18,turn19,turn20,turn21,turn22,turn23 from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,turntime,term,turn0,turn1,turn2,turn3,turn4,turn5,turn6,turn7,turn8,turn9,turn10,turn11,turn12,turn13,turn14,turn15,turn16,turn17,turn18,turn19,turn20,turn21,turn22,turn23 from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); $turn = getTurn($connect, $me, 2); diff --git a/twe/d_ally.php b/twe/d_ally.php index 480b117b..b502fe0b 100644 --- a/twe/d_ally.php +++ b/twe/d_ally.php @@ -13,7 +13,7 @@ $query = "select year,month from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/d_cancel.php b/twe/d_cancel.php index 960027cd..883e6097 100644 --- a/twe/d_cancel.php +++ b/twe/d_cancel.php @@ -11,7 +11,7 @@ $query = "select year,month from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/d_cease.php b/twe/d_cease.php index c6a185f6..9ceac63a 100644 --- a/twe/d_cease.php +++ b/twe/d_cease.php @@ -11,7 +11,7 @@ $query = "select year,month from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/d_merge.php b/twe/d_merge.php index 9b871c9f..6539b6dd 100644 --- a/twe/d_merge.php +++ b/twe/d_merge.php @@ -11,7 +11,7 @@ $query = "select year,month from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/d_scout.php b/twe/d_scout.php index ac32fd25..12723618 100644 --- a/twe/d_scout.php +++ b/twe/d_scout.php @@ -17,7 +17,7 @@ $query = "select startyear,year,month,killturn from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,nations,level,troop,npc,gold,rice from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,nations,level,troop,npc,gold,rice from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/d_surrender.php b/twe/d_surrender.php index 846567af..df359f4e 100644 --- a/twe/d_surrender.php +++ b/twe/d_surrender.php @@ -11,7 +11,7 @@ $query = "select year,month from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/event_1.php b/twe/event_1.php index e31228bf..ef715b0a 100644 --- a/twe/event_1.php +++ b/twe/event_1.php @@ -11,7 +11,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/event_2.php b/twe/event_2.php index 5d0ad5c9..62e38ba9 100644 --- a/twe/event_2.php +++ b/twe/event_2.php @@ -11,7 +11,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/event_3.php b/twe/event_3.php index 78fc67af..188c6bca 100644 --- a/twe/event_3.php +++ b/twe/event_3.php @@ -11,7 +11,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/event_4.php b/twe/event_4.php index 8c12edc9..acc5183b 100644 --- a/twe/event_4.php +++ b/twe/event_4.php @@ -14,7 +14,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -if(getUserGrade() < 5) { +if(Session::getUserGrade() < 5) { echo " diff --git a/twe/func.php b/twe/func.php index 7c773fed..28b495c5 100644 --- a/twe/func.php +++ b/twe/func.php @@ -42,48 +42,13 @@ function randBool($prob = 0.5){ return randF() < $prob; } -/** - * 로그인한 유저의 전역 id(숫자)를 받아옴 - * - * @return int|null - */ -function getUserID($forceExit=false){ - $userID = util::array_get($_SESSION['noMember'], null); - if(!$userID && $forceExit){ - header('Location:..'); - die(); - } - - if($userID == -1){ - unset($_SESSION['noMember']); - header('Location:..'); - die(); - } - - return $userID; -} - -/** - * 로그인 유저의 전역 grade를 받아옴 - * @return int|null - */ -function getUserGrade($forceExit=false){ - $userGrade = util::array_get($_SESSION['userGrade'], null); - if(!$userGrade && $forceExit){ - header('Location:..'); - die(); - } - - return $userGrade; -} - /** * 로그인한 유저의 장수 id를 받아옴 * * @return int|null */ function getGeneralID($forceExit=false, $countLogin=true){ - $userID = getUserID(); + $userID = Session::getUserID(); if(!$userID){ //유저id 없으면 어차피 의미 없음. return null; } @@ -237,7 +202,7 @@ function isSigned(){ function checkLimit($con, $conlimit) { - if(getUserGrade()>=4){ + if(Session::getUserGrade()>=4){ return 0; } if($con > $conlimit) { @@ -278,7 +243,7 @@ function getRandGenName() { function cityInfo($connect) { global $_basecolor, $_basecolor2, $images; - $query = "select no,city,skin from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,city,skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -393,7 +358,7 @@ function myNationInfo($connect) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select skin,no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select skin,no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -579,7 +544,7 @@ function commandTable($connect) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,npc,troop,city,nation,level,crew,makelimit,special from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,npc,troop,city,nation,level,crew,makelimit,special from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -813,7 +778,7 @@ function CoreCommandTable($connect) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,nation,city,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation,city,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -903,7 +868,7 @@ function CoreCommandTable($connect) { } function myInfo($connect) { - $query = "select no,skin from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -917,7 +882,7 @@ function generalInfo($connect, $no, $skin) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select skin from general where owner='{$_SESSION['noMember']}'"; + $query = "select skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -1100,7 +1065,7 @@ function generalInfo($connect, $no, $skin) { } function myInfo2($connect) { - $query = "select no,skin from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -1522,7 +1487,7 @@ function onlineNation($connect) { } function nationMsg($connect) { - $query = "select no,nation,skin from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation,skin from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -1832,7 +1797,7 @@ function increaseRefresh($type="", $cnt=1) { getDB()->query('UPDATE game set refresh=refresh+%i where `no`=1', $cnt); - if(!util::array_get($_SESSION['noMember'], null)) { + if(!util::array_get($_SESSION['userID'], null)) { getDB()->query('UPDATE general set `lastrefresh`=%s_date, `con`=`con`+%i_cnt, `connect`=`connect`+%i_cnt, refcnt=refcnt+%i_cnt, refresh=refresh+%i_cnt where `no`=%i_no',[ 'date'=>$date, 'cnt'=>$cnt, @@ -1844,7 +1809,7 @@ function increaseRefresh($type="", $cnt=1) { $date2 = substr($date, 0, 10); $online = getOnlineNum(); $fp = fopen("logs/_{$date2}_refresh.txt", "a"); - $msg = _String::Fill2($date,20," ")._String::Fill2($_SESSION['p_id'],13," ")._String::Fill2($_SESSION['p_name'],13," ")._String::Fill2($_SESSION['p_ip'],16," ")._String::Fill2($type, 10, " ")." 동접자: {$online}"; + $msg = _String::Fill2($date,20," ")._String::Fill2($_SESSION['userName'],13," ")._String::Fill2($_SESSION['p_name'],13," ")._String::Fill2($_SESSION['p_ip'],16," ")._String::Fill2($type, 10, " ")." 동접자: {$online}"; fwrite($fp, $msg."\n"); fclose($fp); @@ -1873,7 +1838,7 @@ function increaseRefresh($type="", $cnt=1) { if($str != "") { file_put_contents("logs/_{$date2}_ipcheck.txt", sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s\n", - $_SESSION['p_id'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND); + $_SESSION['userName'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND); } } @@ -2088,7 +2053,7 @@ function checkTurn($connect) { return; } - $locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$_SESSION['p_id']; + $locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog($locklog); // 파일락 해제 @@ -2096,7 +2061,7 @@ function checkTurn($connect) { // 세마포어 해제 //if(!@sem_release($sema)) { echo "치명적 에러! 유기체에게 문의하세요!"; exit(1); } - $locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$_SESSION['p_id']; + $locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog($locklog); //if(STEP_LOG) delStepLog(); @@ -2162,7 +2127,7 @@ function checkTurn($connect) { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', preUpdateMonthly'); $result = preUpdateMonthly($connect); if($result == false) { - $locklog[0] = "-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['p_id']; + $locklog[0] = "-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog($locklog); // 잡금 해제 @@ -2175,7 +2140,7 @@ function checkTurn($connect) { $dt = turnDate($connect, $nextTurn); $admin['year'] = $dt[0]; $admin['month'] = $dt[1]; - $locklog[0] = "-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$_SESSION['p_id']; + $locklog[0] = "-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog($locklog); // 분기계산. 장수들 턴보다 먼저 있다면 먼저처리 if($admin['month'] == 1) { @@ -2291,7 +2256,7 @@ function checkTurn($connect) { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock'); unlock(); - $locklog[0] = "- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['p_id']; + $locklog[0] = "- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog($locklog); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', finish'); @@ -2920,7 +2885,7 @@ function getAdmin($connect) { } function getMe($connect) { - $query = "select * from general where owner='{$_SESSION['noMember']}'"; + $query = "select * from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("접속자가 많아 접속을 중단합니다. 잠시후 갱신해주세요.
getMe : ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/func_command.php b/twe/func_command.php index 6e1d318d..4c4fcdb1 100644 --- a/twe/func_command.php +++ b/twe/func_command.php @@ -523,7 +523,7 @@ function processCommand($connect, $no) { if($general['npc'] >= 2 || $general['killturn'] > $admin['killturn']) { $query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } elseif(floor($command[0]) == 0 && getUserGrade() < 5) { + } elseif(floor($command[0]) == 0 && Session::getUserGrade() < 5) { $query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } else { @@ -674,7 +674,7 @@ function command_Single($connect, $turn, $command) { for($i=0; $i < $count; $i++) { $str .= ",turn{$turn[$i]}='{$command}'"; } - $query = "update general set {$str} where owner='{$_SESSION['noMember']}'"; + $query = "update general set {$str} where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //echo ""; echo 'commandlist.php';//TODO:debug all and replace @@ -684,7 +684,7 @@ function command_Single($connect, $turn, $command) { function command_Chief($connect, $turn, $command) { $command = EncodeCommand(0, 0, 0, $command); - $query = "select nation,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/func_legacy.php b/twe/func_legacy.php index 224f357f..d9ba5efe 100644 --- a/twe/func_legacy.php +++ b/twe/func_legacy.php @@ -3,7 +3,7 @@ namespace sammo; function CheckLogin($type=0) { - if(!isset($_SESSION['noMember'])) { + if(!isset($_SESSION['userID'])) { if($type == 0) { header('Location: ../'); } diff --git a/twe/func_message.php b/twe/func_message.php index d9e5a22d..ded2ee5a 100644 --- a/twe/func_message.php +++ b/twe/func_message.php @@ -282,7 +282,7 @@ function getMailboxList(){ // who : xxxx,xxxx(발신인, 수신인) function DecodeMsg($connect, $msg, $type, $who, $date, $bg, $num=0) { //FIXME: 폐기 - $query = "select skin,no,nation,name,picture,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select skin,no,nation,name,picture,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -343,7 +343,7 @@ function moveMsg($connect, $table, $msgtype, $msgnum, $msg, $type, $who, $when, } function MsgDip($connect, $bg) { - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/index.php b/twe/index.php index 47a089c8..aef60c22 100644 --- a/twe/index.php +++ b/twe/index.php @@ -17,7 +17,7 @@ if(!isSigned()){ die(); } -$userID = getUserID(); +$userID = Session::getUserID(); if(!$userID){ header('Location:../'); die(); @@ -33,13 +33,13 @@ if($me === null) { } if($me['newmsg'] == 1 && $me['newvote'] == 1) { - $query = "update general set newmsg=0,newvote=0 where owner='{$_SESSION['noMember']}'"; + $query = "update general set newmsg=0,newvote=0 where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($me['newmsg'] == 1) { - $query = "update general set newmsg=0 where owner='{$_SESSION['noMember']}'"; + $query = "update general set newmsg=0 where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } elseif($me['newvote'] == 1) { - $query = "update general set newvote=0 where owner='{$_SESSION['noMember']}'"; + $query = "update general set newvote=0 where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } @@ -174,7 +174,7 @@ echo " = 5) { +if(Session::getUserGrade() >= 5) { echo "
【 국가방침 】
【 접속자 】
diff --git a/twe/install.php b/twe/install.php index 2d65423a..5f9a82e4 100644 --- a/twe/install.php +++ b/twe/install.php @@ -2,7 +2,7 @@ include "lib.php"; include "func.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/j_adjust_icon.php b/twe/j_adjust_icon.php index 413e62f8..bb64b66e 100644 --- a/twe/j_adjust_icon.php +++ b/twe/j_adjust_icon.php @@ -2,7 +2,7 @@ include('lib.php'); include('func.php'); -$userID = getUserID(); +$userID = Session::getUserID(); $generalID = getGeneralID(); session_write_close(); diff --git a/twe/j_drop_settings.php b/twe/j_drop_settings.php index 8d647a45..3da1af66 100644 --- a/twe/j_drop_settings.php +++ b/twe/j_drop_settings.php @@ -2,7 +2,7 @@ include "lib.php"; include "func.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/j_get_scenario_map.php b/twe/j_get_scenario_map.php index 0acc9356..0ebfb00c 100644 --- a/twe/j_get_scenario_map.php +++ b/twe/j_get_scenario_map.php @@ -1,12 +1,11 @@ getGrade() < 5){ +if($session->userGrade < 5){ Json::die([ 'result'=>false, 'reason'=>'충분한 권한을 가지고 있지 않습니다.' diff --git a/twe/j_init_settings.php b/twe/j_init_settings.php index ab28010c..73706c33 100644 --- a/twe/j_init_settings.php +++ b/twe/j_init_settings.php @@ -3,7 +3,7 @@ include "lib.php"; include "func.php"; include "schema.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/j_msgsubmit.php b/twe/j_msgsubmit.php index beb252a1..185323ee 100644 --- a/twe/j_msgsubmit.php +++ b/twe/j_msgsubmit.php @@ -56,7 +56,7 @@ if(getBlockLevel() == 1 || getBlockLevel() == 3) { $conlimit = $db->queryFirstField('select conlimit from game where no=1'); -$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', getUserID()); +$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', Session::getUserID()); if(!$me){ resetSessionGeneralValues(); diff --git a/twe/j_server_basic_info.php b/twe/j_server_basic_info.php index d8a69599..7bde7129 100644 --- a/twe/j_server_basic_info.php +++ b/twe/j_server_basic_info.php @@ -2,7 +2,7 @@ include "lib.php"; include "func.php"; -if(!getUserID()){ +if(!Session::getUserID()){ Json::die([ 'game'=>'x', 'me'=>'no' @@ -70,7 +70,7 @@ $game['npcCnt'] = $npcCnt; $game['nationCnt'] = $nationCnt; $generalID = getGeneralID(false, false); -$userGrade = getUserGrade(); +$userGrade = Session::getUserGrade(); $me = [ ]; diff --git a/twe/join.php b/twe/join.php index 055802f5..7faca357 100644 --- a/twe/join.php +++ b/twe/join.php @@ -5,7 +5,7 @@ include "lib.php"; include "func.php"; require("new_lib.php"); -$userID = getUserID(); +$userID = Session::getUserID(); if(!$userID) { MessageBox("잘못된 접근입니다!!!"); diff --git a/twe/join_post.php b/twe/join_post.php index 521a984a..c5a3f91f 100644 --- a/twe/join_post.php +++ b/twe/join_post.php @@ -17,7 +17,7 @@ $intel = util::array_get($_POST['intel'], 50); $mylog = []; -$userID = getUserID(); +$userID = Session::getUserID(); if(!$userID) { MessageBox("잘못된 접근입니다!!!"); diff --git a/twe/login_process.php b/twe/login_process.php index 3d099a77..22cb87df 100644 --- a/twe/login_process.php +++ b/twe/login_process.php @@ -10,7 +10,7 @@ include "func.php"; $db = getDB(); -$userID = getUserID(); +$userID = Session::getUserID(); //회원 테이블에서 정보확인 $me= $db->queryFirstRow('select no,name,nation,block,killturn from general where owner= %s', $userID); @@ -44,7 +44,7 @@ $_SESSION['p_time'] = time(); $date = date('Y-m-d H:i:s'); // -$query="update general set logcnt=logcnt+1,ip='{$_SESSION['p_ip']}',lastconnect='$date',conmsg='$conmsg' where owner='{$_SESSION['noMember']}'"; +$query="update general set logcnt=logcnt+1,ip='{$_SESSION['p_ip']}',lastconnect='$date',conmsg='$conmsg' where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $date = date('Y_m_d H:i:s'); diff --git a/twe/old/install.php b/twe/old/install.php index acf40e1d..6019c113 100644 --- a/twe/old/install.php +++ b/twe/old/install.php @@ -3,7 +3,7 @@ namespace sammo; include "lib.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/old/install1.php b/twe/old/install1.php index fcea0f02..4b6d4cc3 100644 --- a/twe/old/install1.php +++ b/twe/old/install1.php @@ -3,7 +3,7 @@ namespace sammo; include "lib.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/old/install2.php b/twe/old/install2.php index eb14cdd1..c2f16e73 100644 --- a/twe/old/install2.php +++ b/twe/old/install2.php @@ -3,7 +3,7 @@ namespace sammo; require "lib.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } ?> diff --git a/twe/old/j_old_install.php b/twe/old/j_old_install.php index 95889d60..ebfc1f88 100644 --- a/twe/old/j_old_install.php +++ b/twe/old/j_old_install.php @@ -5,7 +5,7 @@ include "func.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/old/j_old_install2.php b/twe/old/j_old_install2.php index f3ce7dd1..ec343856 100644 --- a/twe/old/j_old_install2.php +++ b/twe/old/j_old_install2.php @@ -12,7 +12,7 @@ $extend = util::array_get($_POST['extend'],'0'); $npcmode = util::array_get($_POST['npcmode'],'0'); $img = util::array_get($_POST['img'],'0'); -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/old/j_old_install3.php b/twe/old/j_old_install3.php index 6d8973a1..18c06fd6 100644 --- a/twe/old/j_old_install3.php +++ b/twe/old/j_old_install3.php @@ -2,7 +2,7 @@ include "lib.php"; include "func.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ die('관리자 아님'); } diff --git a/twe/preprocessing.php b/twe/preprocessing.php index 193cc0fd..f7f15eb2 100644 --- a/twe/preprocessing.php +++ b/twe/preprocessing.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,con from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,con from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/processing.php b/twe/processing.php index 8fb5afed..8548bc08 100644 --- a/twe/processing.php +++ b/twe/processing.php @@ -172,7 +172,7 @@ function ender($type=0) { } function command_99($connect, $turn) { - $query = "select nation,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -236,7 +236,7 @@ function command_11($connect, $turn, $command) { $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,nation,level,personal,special2,level,city,crew,horse,injury,leader,crewtype,gold from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation,level,personal,special2,level,city,crew,horse,injury,leader,crewtype,gold from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -669,7 +669,7 @@ function command_12($connect, $turn, $command) { $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,nation,personal,special2,level,city,crew,horse,injury,leader,crewtype,gold from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation,personal,special2,level,city,crew,horse,injury,leader,crewtype,gold from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("command_12 ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -1098,7 +1098,7 @@ function calc(cost, formnum) { function command_15($connect, $turn, $command) { starter("재편성"); - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); $me = $general['no']; @@ -1139,7 +1139,7 @@ function command_15($connect, $turn, $command) { function command_16($connect, $turn, $command) { starter("출병"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1178,7 +1178,7 @@ function command_16($connect, $turn, $command) { function command_21($connect, $turn, $command) { starter("이동"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1219,7 +1219,7 @@ function command_22($connect, $turn, $command) { die('비활성화됨');//TODO:등용장 대 디자인 starter("등용"); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -1278,7 +1278,7 @@ function command_22($connect, $turn, $command) { function command_23($connect, $turn, $command) { starter("포상", 1); - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1348,7 +1348,7 @@ function command_23($connect, $turn, $command) { function command_24($connect, $turn, $command) { starter("몰수", 1); - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1426,7 +1426,7 @@ function command_25($connect, $turn, $command) { $result = MYDB_query($query, $connect) or Error("command_46 ".MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,nations from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nations from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("command_27 ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -1496,7 +1496,7 @@ function command_25($connect, $turn, $command) { function command_27($connect, $turn, $command) { starter("발령", 1); - $query = "select no,nation,level from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("command_27 ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -1551,7 +1551,7 @@ function command_27($connect, $turn, $command) { function command_30($connect, $turn, $command) { starter("강행"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1592,7 +1592,7 @@ ender(); function command_31($connect, $turn, $command) { starter("첩보"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1636,7 +1636,7 @@ function command_31($connect, $turn, $command) { function command_32($connect, $turn, $command) { starter("화계"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1675,7 +1675,7 @@ function command_32($connect, $turn, $command) { function command_33($connect, $turn, $command) { starter("탈취"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1714,7 +1714,7 @@ function command_33($connect, $turn, $command) { function command_34($connect, $turn, $command) { starter("파괴"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1753,7 +1753,7 @@ function command_34($connect, $turn, $command) { function command_35($connect, $turn, $command) { starter("선동"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1792,7 +1792,7 @@ function command_35($connect, $turn, $command) { function command_36($connect, $turn, $command) { starter("기습"); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -1831,7 +1831,7 @@ function command_36($connect, $turn, $command) { function command_43($connect, $turn, $command) { starter("증여"); - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2042,7 +2042,7 @@ function command_46($connect, $turn, $command) { function command_48($connect, $turn, $command) { starter("장비 매매"); - $query = "select no,city,gold from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,city,gold from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("command_48 ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); $city = getCity($connect, $me['city'], "secu"); @@ -2152,7 +2152,7 @@ function command_49($connect, $turn, $command) { function command_51($connect, $turn, $command) { starter("항복 권고", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2203,7 +2203,7 @@ function command_51($connect, $turn, $command) { function command_52($connect, $turn, $command) { starter("원조", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2277,7 +2277,7 @@ function command_52($connect, $turn, $command) { function command_53($connect, $turn, $command) { starter("통합제의", 1); - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("command_53 ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2341,7 +2341,7 @@ function command_53($connect, $turn, $command) { function command_54($connect, $turn, $command) { starter("선양"); - $query = "select no,nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2385,7 +2385,7 @@ function command_54($connect, $turn, $command) { function command_61($connect, $turn, $command) { starter("불가침", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2465,7 +2465,7 @@ function command_61($connect, $turn, $command) { function command_62($connect, $turn, $command) { starter("선전포고", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2528,7 +2528,7 @@ function command_62($connect, $turn, $command) { function command_63($connect, $turn, $command) { starter("종전", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2583,7 +2583,7 @@ function command_63($connect, $turn, $command) { function command_64($connect, $turn, $command) { starter("파기", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2637,7 +2637,7 @@ function command_64($connect, $turn, $command) { function command_65($connect, $turn, $command) { starter("초토화", 1); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2673,7 +2673,7 @@ echo "
function command_66($connect, $turn, $command) { starter("천도", 1); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2710,7 +2710,7 @@ echo "
function command_67($connect, $turn, $command) { starter("증축", 1); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2747,7 +2747,7 @@ echo "
function command_68($connect, $turn, $command) { starter("감축", 1); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2784,7 +2784,7 @@ echo "
function command_72($connect, $turn, $command) { starter("백성동원", 1); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2821,7 +2821,7 @@ echo "
function command_73($connect, $turn, $command) { starter("수몰", 1); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2858,7 +2858,7 @@ echo "
function command_74($connect, $turn, $command) { starter("허보", 1); - $query = "select city from general where owner='{$_SESSION['noMember']}'"; + $query = "select city from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2896,7 +2896,7 @@ echo "
function command_75($connect, $turn, $command) { starter("피장파장", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -2952,7 +2952,7 @@ function command_75($connect, $turn, $command) { function command_77($connect, $turn, $command) { starter("이호경식", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -3008,7 +3008,7 @@ function command_77($connect, $turn, $command) { function command_78($connect, $turn, $command) { starter("급습", 1); - $query = "select nation from general where owner='{$_SESSION['noMember']}'"; + $query = "select nation from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/reset.php b/twe/reset.php index af4eb8fe..8546ae3e 100644 --- a/twe/reset.php +++ b/twe/reset.php @@ -5,7 +5,7 @@ include "lib.php"; include "func.php"; include "schema.php"; -if(getUserGrade(true) < 5){ +if(Session::getUserGrade(true) < 5){ echo '관리자 아님'; die(); } diff --git a/twe/select_npc.php b/twe/select_npc.php index daae8305..95de9a1f 100644 --- a/twe/select_npc.php +++ b/twe/select_npc.php @@ -5,7 +5,7 @@ include "lib.php"; include "func.php"; $connect = dbConn(true); -$userID = getUserID(); +$userID = Session::getUserID(); //회원 테이블에서 정보확인 $query = "select no,name,picture,grade from MEMBER where no='$userID'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/twe/select_npc_post.php b/twe/select_npc_post.php index b688b1f0..b83c4d62 100644 --- a/twe/select_npc_post.php +++ b/twe/select_npc_post.php @@ -6,7 +6,7 @@ include "func.php"; $face = $_POST['face'];//TODO: face를 user_id에서 general.no 값을 이용하도록 변경 -$userID = getUserID(); +$userID = Session::getUserID(); $connect = dbConn(true); //회원 테이블에서 정보확인 diff --git a/twe/selection.php b/twe/selection.php index c2ce8d26..b3bff91c 100644 --- a/twe/selection.php +++ b/twe/selection.php @@ -7,7 +7,7 @@ include "func.php"; //TODO: 이게 뭔지 분석 $btn = $_POST['btn']; -$userID = getUserID(); +$userID = Session::getUserID(); $connect = dbConn(true); //회원 테이블에서 정보확인 diff --git a/twe/turn.php b/twe/turn.php index a2e24d84..f4e5c6b4 100644 --- a/twe/turn.php +++ b/twe/turn.php @@ -14,7 +14,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,con from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,con from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -37,7 +37,7 @@ case 0: if($k >= 24) break; $query .= ","; } - $query .= " where owner='{$_SESSION['noMember']}'"; + $query .= " where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } */ @@ -51,7 +51,7 @@ case 0: if($k >= 24) break; } } - $query .= " where owner='{$_SESSION['noMember']}'"; + $query .= " where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case 1: @@ -69,7 +69,7 @@ case 1: if($k < 0) break; $query .= ","; } - $query .= " where owner='{$_SESSION['noMember']}'"; + $query .= " where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; case 2: @@ -87,7 +87,7 @@ case 2: if($i >= 24) break; $query .= ","; } - $query .= " where owner='{$_SESSION['noMember']}'"; + $query .= " where owner='{$_SESSION['userID']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; } diff --git a/twe/turn_pop_core.php b/twe/turn_pop_core.php index 6346a1d9..230f0564 100644 --- a/twe/turn_pop_core.php +++ b/twe/turn_pop_core.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select no from general where owner='{$_SESSION['noMember']}'"; +$query = "select no from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/twe/turn_push_core.php b/twe/turn_push_core.php index 7d1c5316..1f6dd13e 100644 --- a/twe/turn_push_core.php +++ b/twe/turn_push_core.php @@ -7,7 +7,7 @@ include "func.php"; CheckLogin(); $connect = dbConn(); -$query = "select no from general where owner='{$_SESSION['noMember']}'"; +$query = "select no from general where owner='{$_SESSION['userID']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result);