diff --git a/hwe/error.php b/hwe/error.php index 576422f2..8d3fc79d 100644 --- a/hwe/error.php +++ b/hwe/error.php @@ -26,6 +26,7 @@ file_put_contents("logs/_db_bug.txt", $message."\n", FILE_APPEND); 잠시 후 아래의 버튼을 눌러주세요. + diff --git a/hwe/func.php b/hwe/func.php index 19a867ea..0beae65a 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -75,7 +75,7 @@ function getGeneralID($forceExit=false, $countLogin=true){ */ function getGeneralName($forceExit=false) { - $generalID = getGeneralID(); + $generalID = Session::Instance()->generalID; if(!$generalID){ if($forceExit){ header('Location:..'); @@ -177,7 +177,7 @@ function GetImageURL($imgsvr) { * @return bool */ function isSigned(){ - $generalID = getGeneralID(); + $generalID = Session::Instance()->generalID; if(!$generalID){ return false; } @@ -200,7 +200,7 @@ function checkLimit($con, $conlimit) { } function getBlockLevel() { - return DB::db()->queryFirstField('select block from general where no = %i', getGeneralID()); + return DB::db()->queryFirstField('select block from general where no = %i', Session::Instance()->generalID); } function getRandGenName() { @@ -849,7 +849,7 @@ function myInfo($connect) { function generalInfo($connect, $no) { global $_basecolor, $_basecolor2, $image, $images; - $query = "select img from game limit 1"; + $query = "select show_img_level from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -952,7 +952,7 @@ function generalInfo($connect, $no) { echo " - + @@ -1402,20 +1402,16 @@ function getOnlineNum() { function onlinegen($connect) { $onlinegen = ""; - $generalID = getGeneralID(); + $generalID = Session::Instance()->generalID; $nationID = DB::db()->queryFirstField('select `nation` from `general` where `no` = %i', $generalID); - if($nationID !== null || Util::toInt($nationID) === 0) { + if($nationID === null || Util::toInt($nationID) === 0) { $query = "select onlinegen from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); $onlinegen = $game['onlinegen']; } else { - $query = "select onlinegen from nation where nation='{$_SESSION['p_nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $onlinegen = $nation['onlinegen']; + $onlinegen = DB::db()->queryFirstField('select onlinegen from nation where nation=%i',$nationID); } return $onlinegen; } @@ -1572,7 +1568,12 @@ function cutDay($date, int $turnterm) { } function increaseRefresh($type="", $cnt=1) { - $generalID = Session:: + $session = Session::Instance(); + $generalID = $session->generalID; + if(!$generalID){ + $session->loginGame(); + } + $generalID = $session->generalID; $date = date('Y-m-d H:i:s'); DB::db()->query('UPDATE game set refresh=refresh+%i where `no`=1', $cnt); @@ -1581,7 +1582,7 @@ function increaseRefresh($type="", $cnt=1) { DB::db()->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, - 'owner'->getGeneralID() + 'owner'->Session::Instance()->generalID ]); } @@ -1589,7 +1590,7 @@ function increaseRefresh($type="", $cnt=1) { $date2 = substr($date, 0, 10); $online = getOnlineNum(); $fp = fopen("logs/_{$date2}_refresh.txt", "a"); - $msg = StringUtil::Fill2($date,20," ").StringUtil::Fill2($_SESSION['userName'],13," ").StringUtil::Fill2($_SESSION['p_name'],13," ").StringUtil::Fill2($_SESSION['p_ip'],16," ").StringUtil::Fill2($type, 10, " ")." 동접자: {$online}"; + $msg = StringUtil::Fill2($date,20," ").StringUtil::Fill2($session->userName,13," ").StringUtil::Fill2($session->generalName,13," ").StringUtil::Fill2($session->ip,16," ").StringUtil::Fill2($type, 10, " ")." 동접자: {$online}"; fwrite($fp, $msg."\n"); fclose($fp); diff --git a/hwe/func_map.php b/hwe/func_map.php index 19b64663..09ed7d6a 100644 --- a/hwe/func_map.php +++ b/hwe/func_map.php @@ -50,7 +50,7 @@ function getWorldMap($req){ return getHistoryMap($req->year, $req->month); } - $generalID = getGeneralID(false); + $generalID = Session::Instance()->generalID; $db = DB::db(); diff --git a/hwe/func_message.php b/hwe/func_message.php index 2f3ceba6..68d72367 100644 --- a/hwe/func_message.php +++ b/hwe/func_message.php @@ -78,7 +78,7 @@ function getRawMessage($mailbox, $msgType, $limit=30, $fromSeq=null){ } function getMessage($msgType, $nationID=null, $limit=30, $fromSeq=null){ - $generalID = getGeneralID(false); + $generalID = Session::Instance()->generalID; if($generalID === null){ return []; } diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index e018df27..2f3ef099 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -1,5 +1,5 @@ 0) { + if($admin['extended_general'] > 0) { RegGeneral($connect,0,0,$fiction,$turnterm,$startyear,$year,1492, 123, "가화",$img,1492, 0, "-", 50, 66, 40, 0, 176, 224, "-", "-"); RegGeneral($connect,0,0,$fiction,$turnterm,$startyear,$year,1493, 999, "건석",$img,1493, 0, "-", 21, 12, 61, 0, 155, 189, "-", "-"); RegGeneral($connect,0,0,$fiction,$turnterm,$startyear,$year,1494, 999, "견씨",$img,1494, 0, "-", 35, 24, 58, 0, 182, 221, "-", "-"); diff --git a/hwe/func_template.php b/hwe/func_template.php index 71a24e32..88935d80 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -89,7 +89,7 @@ function allButton() { function commandButton() { global $_basecolor, $_basecolor2; - $generalID = getGeneralID(); + $generalID = Session::Instance()->generalID; if($generalID === null){ return ''; diff --git a/hwe/index.php b/hwe/index.php index 63ea1dd8..f68010fa 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -17,7 +17,10 @@ if(!$session->userID){ die(); } -$me = $db->queryFirstRow('SELECT no,con,turntime,newmsg,newvote,map from general where owner = %i', $userID); +$me = $db->queryFirstRow( + 'SELECT no,con,turntime,newmsg,newvote,map from general where owner = %i', + $session->userID +); //그새 사망이면 if($me === null) { @@ -38,7 +41,7 @@ if($me['newmsg'] == 1 && $me['newvote'] == 1) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -$query = "select develcost,online,conlimit,tournament,tnmt_type,turnterm,scenario,scenario_text,extend,fiction,npcmode,vote from game limit 1"; +$query = "select develcost,online,conlimit,tournament,tnmt_type,turnterm,scenario,scenario_text,extended_general,fiction,npcmode,vote from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); @@ -86,7 +89,7 @@ $(function(){ generalID; session_write_close(); if(!$userID){ diff --git a/hwe/j_basic_info.php b/hwe/j_basic_info.php index c9a7e4c2..ba5e0171 100644 --- a/hwe/j_basic_info.php +++ b/hwe/j_basic_info.php @@ -9,7 +9,7 @@ $result = [ "myNationID"=>null, "isChief"=>false ]; -$generalID = getGeneralID(); +$generalID = Session::Instance()->generalID; session_write_close(); diff --git a/hwe/j_get_new_msg.php b/hwe/j_get_new_msg.php index 9d95a543..ec96698f 100644 --- a/hwe/j_get_new_msg.php +++ b/hwe/j_get_new_msg.php @@ -6,7 +6,7 @@ include('func.php'); -$generalID = getGeneralID(); +$generalID = Session::Instance()->generalID; session_write_close(); // 이제 세션 안 쓴다 diff --git a/hwe/j_map.php b/hwe/j_map.php index e1131443..d1bfb90d 100644 --- a/hwe/j_map.php +++ b/hwe/j_map.php @@ -4,9 +4,7 @@ namespace sammo; include 'lib.php'; include 'func.php'; - - -getGeneralID(); +$session = Session::Instance()->loginGame()->setReadOnly(); //읽기 전용이다. 빠르게 세션 끝내자 session_write_close(); diff --git a/hwe/j_msg_contact_list.php b/hwe/j_msg_contact_list.php index 52761512..39a5171d 100644 --- a/hwe/j_msg_contact_list.php +++ b/hwe/j_msg_contact_list.php @@ -6,7 +6,7 @@ include('func.php'); -if(!getGeneralID()){ +if(!Session::Instance()->generalID){ Json::die([ "nation"=>[] ]); diff --git a/hwe/j_msg_decide_opt.php b/hwe/j_msg_decide_opt.php index 3d9ef856..c28eb61a 100644 --- a/hwe/j_msg_decide_opt.php +++ b/hwe/j_msg_decide_opt.php @@ -8,7 +8,7 @@ include 'func.php'; -$generalID = getGeneralID(); +$generalID = Session::Instance()->generalID; if (!$generalID) { Json::die([ diff --git a/hwe/join.php b/hwe/join.php index 87fcb57d..f40aee8f 100644 --- a/hwe/join.php +++ b/hwe/join.php @@ -183,7 +183,7 @@ window.abilityPowint = abilityPowint;
 {$specUser} {$general['name']} 【 {$level} | {$call} | {$color}{$injury} 】 ".substr($general['turntime'], 11)."{$general['name']} 【 {$level} | {$call} | {$color}{$injury} 】 ".substr($general['turntime'], 11)."
통솔
id; + $recruitCondition = CityConst::$regionMap[$recruitCondition]; } else if($recruitType == 2){ $info[] = "{$recruitCondition} 소유시 가능"; - $recruitCondition = CityConst::$regionMap[$recruitCondition]->id; + $recruitCondition = CityConst::byName($recruitCondition)->id; } diff --git a/hwe/sammo/Scenario.php b/hwe/sammo/Scenario.php index 41c2c339..1562a57b 100644 --- a/hwe/sammo/Scenario.php +++ b/hwe/sammo/Scenario.php @@ -291,8 +291,8 @@ class Scenario{ /* env로 사용된 것들, 게임 변수 : year, month - game 테이블 변수 : startyear, year, month, genius, turnterm, show_img_level, extend, fiction, npcmode - install 변수 : npcmode, show_img_level, extend, scenario, fiction + game 테이블 변수 : startyear, year, month, genius, turnterm, show_img_level, extended_general, fiction, npcmode + install 변수 : npcmode, show_img_level, extended_general, scenario, fiction event변수 : currentEventID */ diff --git a/src/sammo/Session.php b/src/sammo/Session.php index 61bc6654..0e0514f9 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -182,7 +182,7 @@ class Session { $now = time(); if( - $generalID && $generalName && $loginDate && $deateTime + $generalID && $generalName && $loginDate && $deadTime && $loginDate + 600 > $now && $deadTime > $now ){ //로그인 정보는 10분간 유지한다. @@ -225,8 +225,9 @@ class Session { $this->set($serverID.static::GAME_KEY_DATE, $now); $this->set($serverID.static::GAME_KEY_GENERAL_ID, $generalID); - $this->set($preserverIDfix.static::GAME_KEY_GENERAL_NAME, $generalName); + $this->set($serverID.static::GAME_KEY_GENERAL_NAME, $generalName); $this->set($serverID.static::GAME_KEY_EXPECTED_DEADTIME, $deadTime); + return $this; } public function logoutGame(): Session{