generalID 부분 많이 수정.

index.php 로딩 에러 수정
This commit is contained in:
2018-04-01 04:31:56 +09:00
parent 762e7f72c3
commit 6edabd5bcb
18 changed files with 43 additions and 39 deletions
+1
View File
@@ -26,6 +26,7 @@ file_put_contents("logs/_db_bug.txt", $message."\n", FILE_APPEND);
<tr><td align=center><font color=white size=3>잠시 후 아래의 버튼을 눌러주세요.</font></td></tr>
<tr><td align=center><input type=button value='몇초간 지난 후 눌러주세요' onclick=location.replace('index.php')></td></tr>
<tr><td align=center><?=$message;?></td></tr>
<tr><td><?php debug_print_backtrace(); ?></td></tr>
</table>
</body>
</html>
+16 -15
View File
@@ -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 "<table width=498 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
<tr>
<td width=64 height=64 align=center rowspan=3 background={$imageTemp}/{$general['picture']}>&nbsp;</td>
<td align=center colspan=9 height=16 style=color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$specUser} {$general['name']}{$level} | {$call} | {$color}{$injury}</font> 】 ".substr($general['turntime'], 11)."</td>
<td align=center colspan=9 height=16 style=color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$general['name']}{$level} | {$call} | {$color}{$injury}</font> 】 ".substr($general['turntime'], 11)."</td>
</tr>
<tr height=16>
<td align=center id=bg1><b>통솔</b></td>
@@ -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);
+1 -1
View File
@@ -50,7 +50,7 @@ function getWorldMap($req){
return getHistoryMap($req->year, $req->month);
}
$generalID = getGeneralID(false);
$generalID = Session::Instance()->generalID;
$db = DB::db();
+1 -1
View File
@@ -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 [];
}
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
namespace sammo;
function process_22($connect, &$general) {
$log = array();
+2 -2
View File
@@ -3,7 +3,7 @@ namespace sammo;
function RegNPC($connect) {
$query = "select startyear,year,turnterm,scenario,extend,fiction,img from game limit 1";
$query = "select startyear,year,turnterm,scenario,extended_general,fiction,img from game limit 1";
$result = MYDB_query($query, $connect) or Error("scenario_194A ".MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
@@ -502,7 +502,7 @@ function RegNPC($connect) {
RegGeneral($connect,0,0,$fiction,$turnterm,$startyear,$year,1490, 50, "황호",$img,1490, 0, "-", 15, 17, 48, 0, 226, 263, "안전", "-");
RegGeneral($connect,0,0,$fiction,$turnterm,$startyear,$year,1491, 147, "후성",$img,1491, 0, "-", 56, 62, 33, 0, 158, 199, "정복", "-");
if($admin['extend'] > 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, "-", "-");
+1 -1
View File
@@ -89,7 +89,7 @@ function allButton() {
function commandButton() {
global $_basecolor, $_basecolor2;
$generalID = getGeneralID();
$generalID = Session::Instance()->generalID;
if($generalID === null){
return '';
+6 -3
View File
@@ -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(){
</tr>
<?php
$valid = 0;
if($admin['extend'] == 0) { $extend = "표준"; }
if($admin['extended_general'] == 0) { $extend = "표준"; }
else { $extend = "확장"; $valid = 1; }
if($admin['fiction'] == 0) { $fiction = "사실"; }
else { $fiction = "가상"; $valid = 1; }
+1 -1
View File
@@ -5,7 +5,7 @@ include('lib.php');
include('func.php');
$userID = Session::getUserID();
$generalID = getGeneralID();
$generalID = Session::Instance()->generalID;
session_write_close();
if(!$userID){
+1 -1
View File
@@ -9,7 +9,7 @@ $result = [
"myNationID"=>null,
"isChief"=>false
];
$generalID = getGeneralID();
$generalID = Session::Instance()->generalID;
session_write_close();
+1 -1
View File
@@ -6,7 +6,7 @@ include('func.php');
$generalID = getGeneralID();
$generalID = Session::Instance()->generalID;
session_write_close(); // 이제 세션 안 쓴다
+1 -3
View File
@@ -4,9 +4,7 @@ namespace sammo;
include 'lib.php';
include 'func.php';
getGeneralID();
$session = Session::Instance()->loginGame()->setReadOnly();
//읽기 전용이다. 빠르게 세션 끝내자
session_write_close();
+1 -1
View File
@@ -6,7 +6,7 @@ include('func.php');
if(!getGeneralID()){
if(!Session::Instance()->generalID){
Json::die([
"nation"=>[]
]);
+1 -1
View File
@@ -8,7 +8,7 @@ include 'func.php';
$generalID = getGeneralID();
$generalID = Session::Instance()->generalID;
if (!$generalID) {
Json::die([
+1 -1
View File
@@ -183,7 +183,7 @@ window.abilityPowint = abilityPowint;
<tr><td align=center><?php info($connect, 0, 1); ?></td></tr>
</table>
<?php
$query = "select img,maxgeneral from game limit 1";
$query = "select show_img_level,maxgeneral from game limit 1";
$result = MYDB_query($query, $connect) or Error("join ".MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
+2 -2
View File
@@ -111,11 +111,11 @@ class GameUnitConst{
if($recruitType == 1){
$info[] = "{$recruitCondition}지역 소유시 가능";
$recruitCondition = CityConst::byName($recruitCondition)->id;
$recruitCondition = CityConst::$regionMap[$recruitCondition];
}
else if($recruitType == 2){
$info[] = "{$recruitCondition} 소유시 가능";
$recruitCondition = CityConst::$regionMap[$recruitCondition]->id;
$recruitCondition = CityConst::byName($recruitCondition)->id;
}
+2 -2
View File
@@ -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
*/
+3 -2
View File
@@ -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{