From d8b87f1e70d288e15681e6f10e4882f528280bd8 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 4 Apr 2018 03:12:58 +0900 Subject: [PATCH] =?UTF-8?q?Session::requireGameLogin=20=EB=B2=84=EA=B7=B8?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/index.php | 2 +- hwe/j_msgsubmit.php | 2 +- hwe/lib.php | 13 ++++--------- src/sammo/Session.php | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/hwe/index.php b/hwe/index.php index d8f28ec8..7b608db0 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -6,7 +6,6 @@ include "func.php"; $session = Session::requireGameLogin(); -$connect = dbConn(); increaseRefresh("메인", 1); $db = DB::db(); @@ -30,6 +29,7 @@ if($me === null) { $session->setReadOnly(); //턴 실행. +$connect = dbConn(); checkTurn($connect); if($me['newmsg'] == 1 && $me['newvote'] == 1) { diff --git a/hwe/j_msgsubmit.php b/hwe/j_msgsubmit.php index 28a5b8c1..ea80522a 100644 --- a/hwe/j_msgsubmit.php +++ b/hwe/j_msgsubmit.php @@ -51,7 +51,7 @@ $conlimit = $db->queryFirstField('select conlimit from game limit 1'); $me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', Session::getUserID()); if(!$me){ - resetSessionGeneralValues(); + $session->logoutGame(); Json::die([ 'result' => false, 'reason' => '로그인되지 않았습니다.', diff --git a/hwe/lib.php b/hwe/lib.php index 8477680a..7d9d82d0 100644 --- a/hwe/lib.php +++ b/hwe/lib.php @@ -76,14 +76,7 @@ $image = "/image"; session_cache_limiter('nocache');//NOTE: 캐시가 가능하도록 설정해야 할 수도 있음. 주의! //FIXME: 이곳에서 설정하면 안될 듯 하다. 옮기자. -/** - * Session에 보관된 장수 정보를 제거함. - * _prefix_p_no, _prefix_p_name 두 값임 - */ -function resetSessionGeneralValues() -{ - Session::Instance()->logoutGame(); -} +ob_start(); // MySQL 데이타 베이스에 접근 function dbConn($isRoot=false) @@ -101,10 +94,12 @@ function Error($message, $url="") $url = $_SERVER['REQUEST_URI']; } WebUtil::setHeaderNoCache(); - file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":$url,\"msg\":\"$message\"}\n", FILE_APPEND); + file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND); $templates = new \League\Plates\Engine('templates'); + ob_get_flush(); + die($templates->render('error', [ 'message' => $msg ])); diff --git a/src/sammo/Session.php b/src/sammo/Session.php index f65794e1..50ec6fe7 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -77,7 +77,7 @@ class Session { static::die($result); } - public static function requireGameLogin($movePath = ROOT): Session{ + public static function requireGameLogin($result = ROOT): Session{ $session = Session::requireLogin()->loginGame(); if($session->generalID){