diff --git a/hwe/_admin5_submit.php b/hwe/_admin5_submit.php index e89f90a6..2df54227 100644 --- a/hwe/_admin5_submit.php +++ b/hwe/_admin5_submit.php @@ -7,7 +7,7 @@ include "func.php"; $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); -if(Session::getUserGrade() < 5) { +if($session->userGrade < 5) { //echo ""; echo '_admin5.php';//TODO:debug all and replace } @@ -15,10 +15,10 @@ if(Session::getUserGrade() < 5) { switch($btn) { case "국가변경": if($nation == 0) { - $query = "update general set nation=0,level=0 where owner='{$_SESSION['userID']}'"; + $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['userID']}'"; + $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/hwe/_simul.php b/hwe/_simul.php index 0a51ab75..3cd2379e 100644 --- a/hwe/_simul.php +++ b/hwe/_simul.php @@ -50,7 +50,7 @@ $rice = 0; $connect = dbConn(); increaseRefresh("시뮬", 2); -$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['userID']}'"; +$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); diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php index 52ecb5b2..df0a78b3 100644 --- a/hwe/a_bestGeneral.php +++ b/hwe/a_bestGeneral.php @@ -13,7 +13,7 @@ $query = "select conlimit from game limit 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['userID']}'"; +$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/hwe/a_genList.php b/hwe/a_genList.php index 52d7ecbe..453c7241 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -12,7 +12,7 @@ $query = "select conlimit from game limit 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['userID']}'"; +$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/hwe/a_history.php b/hwe/a_history.php index 82f1bc2f..37ca7307 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -13,7 +13,7 @@ $query = "select startyear,year,month,conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select map,con,turntime from general where owner='{$_SESSION['userID']}'"; +$query = "select 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/hwe/a_kingdomList.php b/hwe/a_kingdomList.php index ef1f24b3..3ce7848d 100644 --- a/hwe/a_kingdomList.php +++ b/hwe/a_kingdomList.php @@ -12,7 +12,7 @@ $query = "select conlimit from game limit 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['userID']}'"; +$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/hwe/a_status.php b/hwe/a_status.php index 52a89bab..5b617f43 100644 --- a/hwe/a_status.php +++ b/hwe/a_status.php @@ -13,7 +13,7 @@ $query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select map,con,turntime from general where owner='{$_SESSION['userID']}'"; +$query = "select 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/hwe/a_vote.php b/hwe/a_vote.php index 10e6ea3a..3168a50d 100644 --- a/hwe/a_vote.php +++ b/hwe/a_vote.php @@ -6,7 +6,7 @@ include "func.php"; $connect = dbConn(); increaseRefresh("설문조사", 1); -$query = "select no,vote from general where owner='{$_SESSION['userID']}'"; +$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); diff --git a/hwe/b_auction.php b/hwe/b_auction.php index b10ab8b5..fc0a996a 100644 --- a/hwe/b_auction.php +++ b/hwe/b_auction.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("거래장", 2); -$query = "select no,special,con,turntime from general where owner='{$_SESSION['userID']}'"; +$query = "select no,special,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/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index 50d5ac28..c5f68c8a 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/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 no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; +$query = "select 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/hwe/b_betting.php b/hwe/b_betting.php index 0109d7bc..11092da2 100644 --- a/hwe/b_betting.php +++ b/hwe/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['userID']}'"; +$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['userID']}'"; +$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/hwe/b_chiefboard.php b/hwe/b_chiefboard.php index 76b8cd9e..4a63d0e3 100644 --- a/hwe/b_chiefboard.php +++ b/hwe/b_chiefboard.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("기밀실", 1); -$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; +$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/hwe/b_chiefcenter.php b/hwe/b_chiefcenter.php index aa0eb10f..8654ce70 100644 --- a/hwe/b_chiefcenter.php +++ b/hwe/b_chiefcenter.php @@ -12,7 +12,7 @@ $query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; +$query = "select 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/hwe/b_currentCity.php b/hwe/b_currentCity.php index 6c5c639f..9873ecd2 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("현재도시", 1); -$query = "select no,nation,level,city from general where owner='{$_SESSION['userID']}'"; +$query = "select 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); diff --git a/hwe/b_dipcenter.php b/hwe/b_dipcenter.php index 6c5cb796..1e4c905d 100644 --- a/hwe/b_dipcenter.php +++ b/hwe/b_dipcenter.php @@ -12,7 +12,7 @@ $query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; +$query = "select 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/hwe/b_diplomacy.php b/hwe/b_diplomacy.php index e3725c64..7e065efa 100644 --- a/hwe/b_diplomacy.php +++ b/hwe/b_diplomacy.php @@ -12,7 +12,7 @@ $query = "select turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,nation,map from general where owner='{$_SESSION['userID']}'"; +$query = "select no,nation,map 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/hwe/b_genList.php b/hwe/b_genList.php index af8451da..9827a97f 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -12,7 +12,7 @@ $query = "select conlimit from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; +$query = "select 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/hwe/b_myBossInfo.php b/hwe/b_myBossInfo.php index 9e9f4e9a..f7726b2f 100644 --- a/hwe/b_myBossInfo.php +++ b/hwe/b_myBossInfo.php @@ -10,7 +10,7 @@ increaseRefresh("인사부", 1); //훼섭 추방을 위해 갱신 checkTurn($connect); -$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; +$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/hwe/b_myCityInfo.php b/hwe/b_myCityInfo.php index 4a5cab03..b2888fe3 100644 --- a/hwe/b_myCityInfo.php +++ b/hwe/b_myCityInfo.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("세력도시", 1); -$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; +$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); @@ -55,7 +55,7 @@ $sel[$type] = "selected"; userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/hwe/b_myGenInfo.php b/hwe/b_myGenInfo.php index 5c19cb7b..4e8fe9fa 100644 --- a/hwe/b_myGenInfo.php +++ b/hwe/b_myGenInfo.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("세력장수", 1); -$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; +$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/hwe/b_myKingdomInfo.php b/hwe/b_myKingdomInfo.php index e3d08293..1d2a2640 100644 --- a/hwe/b_myKingdomInfo.php +++ b/hwe/b_myKingdomInfo.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("세력정보", 1); -$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; +$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); @@ -33,7 +33,7 @@ if($me['level'] == 0) {
userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index e3546aa7..640663b5 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("내정보", 1); -$query = "select myset from general where owner='{$_SESSION['userID']}'"; +$query = "select myset from general where owner='{$session->userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -25,11 +25,11 @@ if($btn == "설정저장" && $me['myset'] > 0) { $submit = 'hidden'; } - $query = "update general set myset=myset-1,map='$map',mode='$mode',tnmt='$tnmt' where owner='{$_SESSION['userID']}'"; + $query = "update general set myset=myset-1,map='$map',mode='$mode',tnmt='$tnmt' where owner='{$session->userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -$query = "select no,map,mode,tnmt,myset from general where owner='{$_SESSION['userID']}'"; +$query = "select no,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/hwe/b_nationboard.php b/hwe/b_nationboard.php index 80f0a7e0..3b4d6c23 100644 --- a/hwe/b_nationboard.php +++ b/hwe/b_nationboard.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("회의실", 1); -$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; +$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/hwe/b_nationrule.php b/hwe/b_nationrule.php index 99fb83e5..d3bcfa53 100644 --- a/hwe/b_nationrule.php +++ b/hwe/b_nationrule.php @@ -23,7 +23,7 @@ increaseRefresh("국법", 1); userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/hwe/b_tournament.php b/hwe/b_tournament.php index 50407f85..2e1b254a 100644 --- a/hwe/b_tournament.php +++ b/hwe/b_tournament.php @@ -9,7 +9,7 @@ $connect = dbConn(); increaseRefresh("토너먼트", 1); checkTurn($connect); -$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['userID']}'"; +$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); diff --git a/hwe/b_troop.php b/hwe/b_troop.php index 5985f18a..f00410bc 100644 --- a/hwe/b_troop.php +++ b/hwe/b_troop.php @@ -8,7 +8,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); increaseRefresh("부대편성", 1); -$query = "select no,nation,troop from general where owner='{$_SESSION['userID']}'"; +$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/hwe/c_auction.php b/hwe/c_auction.php index 8592da3f..b992ad9a 100644 --- a/hwe/c_auction.php +++ b/hwe/c_auction.php @@ -12,7 +12,7 @@ $query = "select turnterm from game limit 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['userID']}'"; +$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); diff --git a/hwe/c_betting.php b/hwe/c_betting.php index 401eacb7..c79403a6 100644 --- a/hwe/c_betting.php +++ b/hwe/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['userID']}'"; +$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['userID']}'"; + $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'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/c_chiefboard.php b/hwe/c_chiefboard.php index 515f5a6c..e673314c 100644 --- a/hwe/c_chiefboard.php +++ b/hwe/c_chiefboard.php @@ -10,7 +10,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); if(getBlockLevel() != 1 && getBlockLevel() != 3) { - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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/hwe/c_dipcenter.php b/hwe/c_dipcenter.php index 5ca329b1..98f47be0 100644 --- a/hwe/c_dipcenter.php +++ b/hwe/c_dipcenter.php @@ -9,7 +9,7 @@ include "func.php"; $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); -$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; +$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/hwe/c_double.php b/hwe/c_double.php index e06b815b..4a9b7662 100644 --- a/hwe/c_double.php +++ b/hwe/c_double.php @@ -32,7 +32,7 @@ if($command == 46) { if($name == "") { $name = "무명"; } $name = StringUtil::SubStrForWidth($name, 0, 12); - $query = "update general set makenation='{$name}' where owner='{$_SESSION['userID']}'"; + $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['userID']}'"; + $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['userID']}'"; + $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['userID']}'"; + $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['userID']}'"; + $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['userID']}'"; + $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/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index 0b52fe27..b0522ff6 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -13,7 +13,7 @@ $query = "select startyear,year,month from game limit 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['userID']}'"; +$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/hwe/c_nationboard.php b/hwe/c_nationboard.php index 1dd33486..af75b442 100644 --- a/hwe/c_nationboard.php +++ b/hwe/c_nationboard.php @@ -10,7 +10,7 @@ $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); if(getBlockLevel() != 1 && getBlockLevel() != 3) { - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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/hwe/c_nationrule.php b/hwe/c_nationrule.php index 467a2e70..98a17384 100644 --- a/hwe/c_nationrule.php +++ b/hwe/c_nationrule.php @@ -9,7 +9,7 @@ include "func.php"; $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); -$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; +$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/hwe/c_tournament.php b/hwe/c_tournament.php index 9bdf425f..54f587a5 100644 --- a/hwe/c_tournament.php +++ b/hwe/c_tournament.php @@ -13,7 +13,7 @@ $query = "select tournament,phase,tnmt_type,develcost from game limit 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['userID']}'"; +$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); diff --git a/hwe/c_vacation.php b/hwe/c_vacation.php index d2e6e998..d7351e37 100644 --- a/hwe/c_vacation.php +++ b/hwe/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['userID']}'"; +$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/hwe/c_vote.php b/hwe/c_vote.php index 71c44fa2..519cba0b 100644 --- a/hwe/c_vote.php +++ b/hwe/c_vote.php @@ -11,13 +11,13 @@ $query = "select develcost,vote,votecomment from game limit 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['userID']}'"; +$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['userID']}'"; + $query = "update general set gold=gold+{$develcost},vote='{$sel}' where owner='{$session->userID}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $log = []; diff --git a/hwe/commandlist.php b/hwe/commandlist.php index 934b1951..1e237935 100644 --- a/hwe/commandlist.php +++ b/hwe/commandlist.php @@ -73,7 +73,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['userID']}'"; + $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/hwe/d_ally.php b/hwe/d_ally.php index b9887c08..8caed3f1 100644 --- a/hwe/d_ally.php +++ b/hwe/d_ally.php @@ -13,7 +13,7 @@ $query = "select year,month from game limit 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['userID']}'"; +$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/hwe/d_cancel.php b/hwe/d_cancel.php index 2da8c2b8..611ddeef 100644 --- a/hwe/d_cancel.php +++ b/hwe/d_cancel.php @@ -11,7 +11,7 @@ $query = "select year,month from game limit 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['userID']}'"; +$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/hwe/d_cease.php b/hwe/d_cease.php index 0acfff42..e036e41f 100644 --- a/hwe/d_cease.php +++ b/hwe/d_cease.php @@ -11,7 +11,7 @@ $query = "select year,month from game limit 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['userID']}'"; +$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/hwe/d_merge.php b/hwe/d_merge.php index 9b14695c..6663624a 100644 --- a/hwe/d_merge.php +++ b/hwe/d_merge.php @@ -11,7 +11,7 @@ $query = "select year,month from game limit 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['userID']}'"; +$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/hwe/d_scout.php b/hwe/d_scout.php index a44a4f2a..463c1f87 100644 --- a/hwe/d_scout.php +++ b/hwe/d_scout.php @@ -17,7 +17,7 @@ $query = "select startyear,year,month,killturn from game limit 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['userID']}'"; +$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/hwe/d_surrender.php b/hwe/d_surrender.php index 2610b316..1ccbfcd4 100644 --- a/hwe/d_surrender.php +++ b/hwe/d_surrender.php @@ -11,7 +11,7 @@ $query = "select year,month from game limit 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['userID']}'"; +$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/hwe/func.php b/hwe/func.php index af17606c..196bcfe9 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -118,7 +118,7 @@ function getRandGenName() { function cityInfo($connect) { global $_basecolor, $_basecolor2, $images; - $query = "select no,city from general where owner='{$_SESSION['userID']}'"; + $query = "select no,city from general where owner='{$session->userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); @@ -233,7 +233,7 @@ function myNationInfo($connect) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -406,7 +406,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['userID']}'"; + $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); @@ -640,7 +640,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['userID']}'"; + $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); @@ -730,7 +730,7 @@ function CoreCommandTable($connect) { } function myInfo($connect) { - $query = "select no from general where owner='{$_SESSION['userID']}'"; + $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); @@ -914,7 +914,7 @@ function generalInfo($connect, $no) { } function myInfo2($connect) { - $query = "select no from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1064,7 +1064,7 @@ function onlineNation($connect) { } function nationMsg($connect) { - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1226,7 +1226,7 @@ function increaseRefresh($type="", $cnt=1) { 'connect'=>$db->sqleval('connect + %i', $cnt), 'refcnt'=>$db->sqleval('refcnt + %i', $cnt), 'refresh'=>$db->sqleval('refresh + %i', $cnt) - ], 'no=%i', $generalID); + ], 'owner=%i', $generalID); } $date = date('Y_m_d H:i:s'); @@ -1463,7 +1463,9 @@ function checkTurn($connect) { return; } - $locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; + $session = Session::Instance(); + + $locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$session->userName; pushLockLog($locklog); // 파일락 해제 @@ -1471,7 +1473,7 @@ function checkTurn($connect) { // 세마포어 해제 //if(!@sem_release($sema)) { echo "치명적 에러! 유기체에게 문의하세요!"; exit(1); } - $locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; + $locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName; pushLockLog($locklog); //if(STEP_LOG) delStepLog(); @@ -1537,7 +1539,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['userName']; + $locklog[0] = "-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$session->userName; pushLockLog($locklog); // 잡금 해제 @@ -1550,7 +1552,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['userName']; + $locklog[0] = "-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$session->userName; pushLockLog($locklog); // 이벤트 핸들러 동작 @@ -1676,7 +1678,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['userName']; + $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'); @@ -2296,7 +2298,7 @@ function getAdmin($connect) { } function getMe($connect) { - $query = "select * from general where owner='{$_SESSION['userID']}'"; + $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/hwe/func_command.php b/hwe/func_command.php index 01b5711a..06c81b84 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -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['userID']}'"; + $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['userID']}'"; + $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/hwe/func_message.php b/hwe/func_message.php index 24244c33..e443cc59 100644 --- a/hwe/func_message.php +++ b/hwe/func_message.php @@ -279,7 +279,7 @@ function getMailboxList(){ // who : xxxx,xxxx(발신인, 수신인) function DecodeMsg($connect, $msg, $type, $who, $date, $bg, $num=0) { //FIXME: 폐기 - $query = "select no,nation,name,picture,level from general where owner='{$_SESSION['userID']}'"; + $query = "select 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); @@ -340,7 +340,7 @@ function moveMsg($connect, $table, $msgtype, $msgnum, $msg, $type, $who, $when, } function MsgDip($connect, $bg) { - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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/hwe/index.php b/hwe/index.php index a8234939..6fe5200a 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -35,13 +35,13 @@ $session->setReadOnly(); if($me['newmsg'] == 1 && $me['newvote'] == 1) { - $query = "update general set newmsg=0,newvote=0 where owner='{$_SESSION['userID']}'"; + $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['userID']}'"; + $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['userID']}'"; + $query = "update general set newvote=0 where owner='{$session->userID}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } diff --git a/hwe/j_msgsubmit.php b/hwe/j_msgsubmit.php index 31c5ae89..ea4dd1de 100644 --- a/hwe/j_msgsubmit.php +++ b/hwe/j_msgsubmit.php @@ -7,7 +7,8 @@ include 'func.php'; $session = Session::requireGameLogin([ 'newSeq' => false -])->setReadOnly(); +]); +//NOTE: 전송 메시지 시간 계산을 위해 Session을 쓰기 가능 상태로 열어둠. /** * 메시지 전송 코드. @@ -15,8 +16,6 @@ $session = Session::requireGameLogin([ * TODO: 장기적으로 ajax는 한곳에 모을 필요가 있을 듯. */ -//읽기 전용이다. 빠르게 세션 끝내자 - $post = WebUtil::parseJsonPost(); if(!isset($post['genlist']) || !isset($post['msg'])){ @@ -112,7 +111,7 @@ if($destMailbox == 9999) { // 개인 메세지 } elseif($destMailbox > 0) { - $last_msg = new \DateTime(Util::array_get($_SESSION['last_msg'], '0000-00-00')); + $last_msg = new \DateTime($session->last_msg?:'0000-00-00'); $msg_interval = $datetime->getTimestamp() - $last_msg->getTimestamp(); //NOTE: 여기서 유저 레벨을 구별할 코드가 필요할까? @@ -134,7 +133,7 @@ if($destMailbox == 9999) { ]); } - $_SESSION['last_msg'] = $date; + $session->last_msg = $date; $dest = [ 'id' => $destMailbox, diff --git a/hwe/preprocessing.php b/hwe/preprocessing.php index 989ec556..cd0dba5f 100644 --- a/hwe/preprocessing.php +++ b/hwe/preprocessing.php @@ -12,7 +12,7 @@ $query = "select conlimit from game limit 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['userID']}'"; +$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/hwe/processing.php b/hwe/processing.php index ecb476d2..4430c65b 100644 --- a/hwe/processing.php +++ b/hwe/processing.php @@ -172,7 +172,7 @@ function ender($type=0) { } function command_99($connect, $turn) { - $query = "select nation,level from general where owner='{$_SESSION['userID']}'"; + $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['userID']}'"; + $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); @@ -441,7 +441,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,level,personal,special2,level,city,crew,horse,injury,leader,crewtype,gold from general where owner='{$_SESSION['userID']}'"; + $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); @@ -643,7 +643,7 @@ function calc(cost, formnum) { function command_15($connect, $turn, $command) { starter("재편성"); - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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']; @@ -684,7 +684,7 @@ function command_15($connect, $turn, $command) { function command_16($connect, $turn, $command) { starter("출병"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -723,7 +723,7 @@ function command_16($connect, $turn, $command) { function command_21($connect, $turn, $command) { starter("이동"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -764,7 +764,7 @@ function command_22($connect, $turn, $command) { die('비활성화됨');//TODO:등용장 대 디자인 starter("등용"); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -823,7 +823,7 @@ function command_22($connect, $turn, $command) { function command_23($connect, $turn, $command) { starter("포상", 1); - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -893,7 +893,7 @@ function command_23($connect, $turn, $command) { function command_24($connect, $turn, $command) { starter("몰수", 1); - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -971,7 +971,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['userID']}'"; + $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); @@ -1041,7 +1041,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['userID']}'"; + $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); @@ -1096,7 +1096,7 @@ function command_27($connect, $turn, $command) { function command_30($connect, $turn, $command) { starter("강행"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1135,7 +1135,7 @@ ender(); function command_31($connect, $turn, $command) { starter("첩보"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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_31($connect, $turn, $command) { function command_32($connect, $turn, $command) { starter("화계"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1216,7 +1216,7 @@ function command_32($connect, $turn, $command) { function command_33($connect, $turn, $command) { starter("탈취"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1254,7 +1254,7 @@ function command_33($connect, $turn, $command) { function command_34($connect, $turn, $command) { starter("파괴"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1292,7 +1292,7 @@ function command_34($connect, $turn, $command) { function command_35($connect, $turn, $command) { starter("선동"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1330,7 +1330,7 @@ function command_35($connect, $turn, $command) { function command_36($connect, $turn, $command) { starter("기습"); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1368,7 +1368,7 @@ function command_36($connect, $turn, $command) { function command_43($connect, $turn, $command) { starter("증여"); - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1579,7 +1579,7 @@ function command_46($connect, $turn, $command) { function command_48($connect, $turn, $command) { starter("장비 매매"); - $query = "select no,city,gold from general where owner='{$_SESSION['userID']}'"; + $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"); @@ -1689,7 +1689,7 @@ function command_49($connect, $turn, $command) { function command_51($connect, $turn, $command) { starter("항복 권고", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1740,7 +1740,7 @@ function command_51($connect, $turn, $command) { function command_52($connect, $turn, $command) { starter("원조", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1814,7 +1814,7 @@ function command_52($connect, $turn, $command) { function command_53($connect, $turn, $command) { starter("통합제의", 1); - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1878,7 +1878,7 @@ function command_53($connect, $turn, $command) { function command_54($connect, $turn, $command) { starter("선양"); - $query = "select no,nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -1922,7 +1922,7 @@ function command_54($connect, $turn, $command) { function command_61($connect, $turn, $command) { starter("불가침", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2002,7 +2002,7 @@ function command_61($connect, $turn, $command) { function command_62($connect, $turn, $command) { starter("선전포고", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2065,7 +2065,7 @@ function command_62($connect, $turn, $command) { function command_63($connect, $turn, $command) { starter("종전", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2120,7 +2120,7 @@ function command_63($connect, $turn, $command) { function command_64($connect, $turn, $command) { starter("파기", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2174,7 +2174,7 @@ function command_64($connect, $turn, $command) { function command_65($connect, $turn, $command) { starter("초토화", 1); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2210,7 +2210,7 @@ echo "
function command_66($connect, $turn, $command) { starter("천도", 1); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2247,7 +2247,7 @@ echo "
function command_67($connect, $turn, $command) { starter("증축", 1); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2284,7 +2284,7 @@ echo "
function command_68($connect, $turn, $command) { starter("감축", 1); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2321,7 +2321,7 @@ echo "
function command_72($connect, $turn, $command) { starter("백성동원", 1); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2358,7 +2358,7 @@ echo "
function command_73($connect, $turn, $command) { starter("수몰", 1); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2395,7 +2395,7 @@ echo "
function command_74($connect, $turn, $command) { starter("허보", 1); - $query = "select city from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2433,7 +2433,7 @@ echo "
function command_75($connect, $turn, $command) { starter("피장파장", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2489,7 +2489,7 @@ function command_75($connect, $turn, $command) { function command_77($connect, $turn, $command) { starter("이호경식", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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); @@ -2545,7 +2545,7 @@ function command_77($connect, $turn, $command) { function command_78($connect, $turn, $command) { starter("급습", 1); - $query = "select nation from general where owner='{$_SESSION['userID']}'"; + $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/hwe/turn.php b/hwe/turn.php index 1b04519a..01772f48 100644 --- a/hwe/turn.php +++ b/hwe/turn.php @@ -14,7 +14,7 @@ $query = "select conlimit from game limit 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['userID']}'"; +$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['userID']}'"; + $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['userID']}'"; + $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['userID']}'"; + $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['userID']}'"; + $query .= " where owner='{$session->userID}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); break; } diff --git a/hwe/turn_pop_core.php b/hwe/turn_pop_core.php index 4b7aeb13..99581e9b 100644 --- a/hwe/turn_pop_core.php +++ b/hwe/turn_pop_core.php @@ -7,7 +7,7 @@ include "func.php"; $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); -$query = "select no from general where owner='{$_SESSION['userID']}'"; +$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/hwe/turn_push_core.php b/hwe/turn_push_core.php index 04e4708c..36c78706 100644 --- a/hwe/turn_push_core.php +++ b/hwe/turn_push_core.php @@ -7,7 +7,7 @@ include "func.php"; $session = Session::requireGameLogin()->setReadOnly(); $connect = dbConn(); -$query = "select no from general where owner='{$_SESSION['userID']}'"; +$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/i_entrance/j_delete_me.php b/i_entrance/j_delete_me.php index 5a1857c7..1fd014b0 100644 --- a/i_entrance/j_delete_me.php +++ b/i_entrance/j_delete_me.php @@ -62,8 +62,9 @@ $db->insert('member_log', [ 'action_type'=>'delete' ]); + +$session->access_token = null; $session->logout(); -unset($_SESSION['access_token']); setcookie("hello", "", time()-3600); Json::die([ diff --git a/oauth_kakao/j_change_pw.php b/oauth_kakao/j_change_pw.php index 08ab3546..44db7042 100644 --- a/oauth_kakao/j_change_pw.php +++ b/oauth_kakao/j_change_pw.php @@ -7,18 +7,15 @@ use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; $nowDate = TimeUtil::DatetimeNow(); -$session = Session::Instance(); -if(!$session->isLoggedIn()){ - Json::die([ - 'result'=>false, - 'reason'=>'로그인이 되어있지 않습니다' - ]); -} +$session = Session::requireLogin([ + 'reason'=>'로그인이 되어있지 않습니다' +]); + $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']); -$refresh_token_expires = Util::array_get($_SESSION['refresh_token_expires']); +$access_token = $session->access_token; +$expires = $session->expires; +$refresh_token = $session->refresh_token; +$refresh_token_expires = $session->refresh_token_expires; if(!$access_token || !$expires){ Json::die([ @@ -39,7 +36,7 @@ if($expires < $nowDate && (!$refresh_token || ($refresh_token_expires < $nowDate } if($expires < $nowDate){ - unset($_SESSION['kaccount_email']); + $session->kaccount_email = null; $email = null; $result = $restAPI->refresh_access_token($refresh_token); diff --git a/oauth_kakao/j_check_dup.php b/oauth_kakao/j_check_dup.php index 1969c0c7..a0670fc3 100644 --- a/oauth_kakao/j_check_dup.php +++ b/oauth_kakao/j_check_dup.php @@ -5,11 +5,9 @@ require(__dir__.'/../vendor/autoload.php'); require('lib.join.php'); +$session = Session::Instance()->setReadOnly(); - -session_start(); - -$access_token = Util::array_get($_SESSION['access_token']); +$access_token = $session->access_token; if(!$access_token){ Json::die('로그인 토큰 에러. 다시 로그인을 수행해주세요.'); } diff --git a/oauth_kakao/j_join_process.php b/oauth_kakao/j_join_process.php index 83d1eb6a..b044c1e7 100644 --- a/oauth_kakao/j_join_process.php +++ b/oauth_kakao/j_join_process.php @@ -6,7 +6,7 @@ require('lib.join.php'); use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper; -session_start(); +$session = Session::Instance(); $canJoin = RootDB::db()->queryFirstField('SELECT REG FROM `SYSTEM` WHERE `NO` = 1'); if($canJoin != 'Y'){ @@ -18,10 +18,10 @@ if($canJoin != 'Y'){ $nowDate = TimeUtil::DatetimeNow(); -$access_token = Util::array_get($_SESSION['access_token']); -$expires = Util::array_get($_SESSION['expires']); -$refresh_token = Util::array_get($_SESSION['refresh_token']); -$refresh_token_expires = Util::array_get($_SESSION['refresh_token_expires']); +$access_token = Util::array_get($session->access_token); +$expires = Util::array_get($session->expires); +$refresh_token = Util::array_get($session->refresh_token); +$refresh_token_expires = Util::array_get($session->refresh_token_expires); if(!$access_token){ Json::die([ 'result'=>false, @@ -29,7 +29,7 @@ if(!$access_token){ ]); } if($expires < $nowDate && (!$refresh_token || ($refresh_token_expires < $nowDate))){ - unset($_SESSION['access_token']); + $session->access_token = null; Json::die([ 'result'=>false, 'reason'=>'로그인 토큰 만료.'.$refresh_token_expires.' 다시 카카오로그인을 수행해주세요.' @@ -86,7 +86,7 @@ $restAPI = new Kakao_REST_API_Helper($access_token); if($expires < $nowDate){ $result = $restAPI->refresh_access_token($refresh_token); if(!isset($refresh_token)){ - unset($_SESSION['access_token']); + $session->access_token = null; Json::die([ 'result'=>false, 'reason'=>'카카오 로그인 과정 중 추가 갱신 절차를 실패했습니다' @@ -131,7 +131,7 @@ if(!Util::array_get($me['kaccount_email_verified'],false)){ } $email = $me['kaccount_email']; -$_SESSION['kaccount_email'] = $email; +$session->kaccount_email = $email; $emailChk = checkEmailDup($email); if($emailChk !== true){ $restAPI->unlink(); diff --git a/oauth_kakao/j_login_oauth.php b/oauth_kakao/j_login_oauth.php index ce1a3cef..ffb8edba 100644 --- a/oauth_kakao/j_login_oauth.php +++ b/oauth_kakao/j_login_oauth.php @@ -22,11 +22,11 @@ if($canLogin != 'Y'){ $nowDate = TimeUtil::DatetimeNow(); -$access_token = Util::array_get($_SESSION['access_token']); -$expires = Util::array_get($_SESSION['expires']); -$refresh_token = Util::array_get($_SESSION['refresh_token']); -$refresh_token_expires = Util::array_get($_SESSION['refresh_token_expires']); -$email = Util::array_get($_SESSION['kaccount_email']); +$access_token = $session->access_token; +$expires = $session->expires; +$refresh_token = $session->refresh_token; +$refresh_token_expires = $session->refresh_token_expires; +$email = $session->kaccount_email; if(!$access_token || !$expires){ @@ -47,7 +47,7 @@ if($expires < $nowDate && (!$refresh_token || ($refresh_token_expires < $nowDate } if($expires < $nowDate){ - unset($_SESSION['kaccount_email']); + $session->kaccount_email = null; $email = null; $result = $restAPI->refresh_access_token($refresh_token); @@ -86,7 +86,7 @@ if(!$email){ } $email = $me['kaccount_email']; - $_SESSION['kaccount_email'] = $email; + $session->kaccount_email = $email; } @@ -95,7 +95,7 @@ $userInfo = $RootDB->queryFirstRow( if(!$userInfo){ $restAPI->unlink(); - unset($_SESSION['access_token']); + $session->access_token = null; Json::die([ 'result'=>false, 'reason'=>'카카오로그인에 해당하는 계정이 없습니다. 재 가입을 시도해주세요.' @@ -105,7 +105,7 @@ if(!$userInfo){ if($userInfo['delete_after']){ if($userInfo['delete_after'] < $nowDate){ $restAPI->unlink(); - unset($_SESSION['access_token']); + $session->access_token = null; $RootDB->delete('member', 'no=%i', $userInfo['no']); Json::die([ 'result'=>false, @@ -114,7 +114,7 @@ if($userInfo['delete_after']){ } else{ $restAPI->unlink(); - unset($_SESSION['access_token']); + $session->access_token = null; Json::die([ 'result'=>false, 'reason'=>"삭제 요청된 계정입니다.[{$userInfo['delete_after']}]" diff --git a/oauth_kakao/oauth.php b/oauth_kakao/oauth.php index 1775d1a3..f297e451 100644 --- a/oauth_kakao/oauth.php +++ b/oauth_kakao/oauth.php @@ -26,20 +26,20 @@ $result = $restAPI->create_access_token($auth_code); -if(Util::array_get($result['expires_in'], -1) > 0){ - session_start(); - $restAPI->set_access_token($result['access_token']); - $now = TimeUtil::DatetimeNow(); - $_SESSION['access_token'] = $result['access_token']; - $_SESSION['expires'] = TimeUtil::DatetimeFromSecond($now, $result['expires_in']); - $_SESSION['refresh_token'] = Util::array_get($result['refresh_token']); - $_SESSION['refresh_token_expires'] = TimeUtil::DatetimeFromSecond($now, $result['refresh_token_expires_in']); -} -else{ +if (Util::array_get($result['expires_in'], -1) <= 0) { die('알 수 없는 에러:'.$me['msg']); } -$_SESSION['tmpx'] = Json::encode($result); +$session = Session::Instance(); + +$restAPI->set_access_token($result['access_token']); +$now = TimeUtil::DatetimeNow(); +$session->access_token = $result['access_token']; +$session->expires = TimeUtil::DatetimeFromSecond($now, $result['expires_in']); +$session->refresh_token = Util::array_get($result['refresh_token']); +$session->refresh_token_expires = TimeUtil::DatetimeFromSecond($now, $result['refresh_token_expires_in']); + +$session->tmpx = Json::encode($result); //echo "
\n"; $me = $restAPI->meWithEmail(); @@ -57,7 +57,7 @@ if($me['code']< 0){ } } else{ - $_SESSION['kaccount_email'] = $me['kaccount_email']; + $session->kaccount_email = $me['kaccount_email']; } ?> diff --git a/src/sammo/Session.php b/src/sammo/Session.php index 15bf5c84..40d73b96 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -98,9 +98,9 @@ class Session { //첫 등장 - if(!Util::array_get($_SESSION['ip'])) { - $_SESSION['ip'] = Util::get_client_ip(true); - $_SESSION['time'] = time(); + if(!$this->get('ip')) { + $this->set('ip', Util::get_client_ip(true)); + $this->set('time', time()); } }