diff --git a/d_setting/RootDB.orig.php b/d_setting/RootDB.orig.php index f6c91c40..9c2a43c9 100644 --- a/d_setting/RootDB.orig.php +++ b/d_setting/RootDB.orig.php @@ -13,7 +13,7 @@ class RootDB{ private static $globalSalt = '_tK_globalSalt_'; - private static $serverWebPath = '_tK_serverBasePath'; + public static $serverWebPath = '_tK_serverBasePath'; private function __construct(){ diff --git a/hwe/index.php b/hwe/index.php index 90e039ff..6de4892d 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -4,7 +4,7 @@ namespace sammo; include "lib.php"; include "func.php"; -$session = Session::requireGameLogin(); +$session = Session::requireLogin()->loginGame(); increaseRefresh("메인", 1); @@ -30,6 +30,9 @@ if($me === null) { header('Location: ../'); die(); } +if(!$session->generalID){ + $session = Session::requireGameLogin(); +} $session->setReadOnly(); diff --git a/src/sammo/Session.php b/src/sammo/Session.php index 40d73b96..3474a4af 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -68,7 +68,7 @@ class Session { Json::die($jsonResult); } - public static function requireLogin($result = ROOT): Session{ + public static function requireLogin($result = '..'): Session{ $session = Session::Instance(); if($session->isLoggedIn()){ return $session; @@ -77,7 +77,7 @@ class Session { static::die($result); } - public static function requireGameLogin($result = ROOT): Session{ + public static function requireGameLogin($result = '..'): Session{ $session = Session::requireLogin($result)->loginGame(); if($session->generalID){ @@ -222,7 +222,9 @@ class Session { return $this; } - $turnterm = $db->queryFirstField('SELECT turnterm from game limit 1'); + $gameInstance = $db->queryFirstRow('SELECT turnterm, isUnited from game limit 1'); + $turnterm = $gameInstance['turnterm']; + $isUnited = $gameInstance['isUnited'] != 0; $generalID = $general['no']; $generalName = $general['name']; @@ -230,11 +232,15 @@ class Session { $nextTurn = $nextTurn->getTimestamp(); $deadTime = $nextTurn + $general['killturn'] * $turnterm; - if($deadTime < $now){ - if($result !== null){ - $result = false; + if($deadTime < $now && !$isUnited){ + $locked = $db->queryFirstField('SELECT plock FROM plock LIMIT 1'); + if(!$locked){ + if($result !== null){ + $result = false; + } + return $this; } - return $this; + } $db->update('general', [ @@ -267,7 +273,7 @@ class Session { * 로그인 유저의 전역 grade를 받아옴 * @return int|null */ - public static function getUserGrade(bool $requireLogin = false, string $exitPath = ROOT){ + public static function getUserGrade(bool $requireLogin = false, string $exitPath = '..'){ if($requireLogin){ $obj = self::requireLogin($exitPath); } @@ -283,7 +289,7 @@ class Session { * * @return int|null */ - public static function getUserID(bool $requireLogin = false, string $exitPath = ROOT){ + public static function getUserID(bool $requireLogin = false, string $exitPath = '..'){ if($requireLogin){ $obj = self::requireLogin($exitPath); }