p_id를 noMember 기반으로 변경
This commit is contained in:
+29
-32
@@ -27,10 +27,10 @@ function randF(){
|
||||
/**
|
||||
* 로그인한 유저의 전역 id를 받아옴
|
||||
*
|
||||
* @return string|null
|
||||
* @return int|null
|
||||
*/
|
||||
function getUserID($forceExit=false){
|
||||
$userID = util::array_get($_SESSION['p_id'], null);
|
||||
$userID = util::array_get($_SESSION['noMember'], null);
|
||||
if(!$userID && $forceExit){
|
||||
header('Location:..');
|
||||
die();
|
||||
@@ -47,7 +47,7 @@ function getUserID($forceExit=false){
|
||||
*/
|
||||
function getGeneralID($forceExit=false){
|
||||
$userID = getUserID();
|
||||
if(!$userID){ //유저명 없으면 어차피 의미 없음.
|
||||
if(!$userID){ //유저id 없으면 어차피 의미 없음.
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ function getGeneralID($forceExit=false){
|
||||
|
||||
$db = getDB();
|
||||
//흠?
|
||||
$generalID = $db->queryFirstField('select no from general where user_id = %s', $userID);
|
||||
$generalID = $db->queryFirstField('select no from general where no_member = %i', $userID);
|
||||
if(!$generalID && $forceExit){
|
||||
header('Location:..');
|
||||
die();
|
||||
@@ -679,7 +679,7 @@ function getCoreTurn($connect, $nation, $level) {
|
||||
function cityInfo($connect) {
|
||||
global $_basecolor, $_basecolor2, $images;
|
||||
|
||||
$query = "select no,city,skin from general where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select no,city,skin from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -796,7 +796,7 @@ function myNationInfo($connect) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select skin,no,nation from general where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select skin,no,nation from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -982,7 +982,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 user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select no,npc,troop,city,nation,level,crew,makelimit,special from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1220,7 +1220,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 user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select no,nation,city,level from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1310,7 +1310,7 @@ function CoreCommandTable($connect) {
|
||||
}
|
||||
|
||||
function myInfo($connect) {
|
||||
$query = "select no,skin from general where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select no,skin from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1324,7 +1324,7 @@ function generalInfo($connect, $no, $skin) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select skin from general where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select skin from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1514,7 +1514,7 @@ function generalInfo($connect, $no, $skin) {
|
||||
}
|
||||
|
||||
function myInfo2($connect) {
|
||||
$query = "select no,skin from general where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select no,skin from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1940,7 +1940,7 @@ function onlineNation($connect) {
|
||||
}
|
||||
|
||||
function nationMsg($connect) {
|
||||
$query = "select no,nation,skin from general where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select no,nation,skin from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -2246,23 +2246,20 @@ function CutDay($date) {
|
||||
}
|
||||
|
||||
|
||||
function increateRefreshEx($type, $cnt=1){
|
||||
function increaseRefreshEx($type, $cnt=1){
|
||||
$db = getDB();
|
||||
|
||||
$db->query("update `game` set `refresh` = `refresh` + %d_p_id where `no` = %d_cnt", array(
|
||||
'p_id'=>$p_id,
|
||||
'cnt'=>$cnt
|
||||
));
|
||||
$db->query("update `game` set `refresh` = `refresh` + %i where `no` = 1", $cnt);
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$generalID = getGeneralID();
|
||||
if($p_id !== NULL){
|
||||
if($generalID !== NULL){
|
||||
|
||||
$db->query("update `general` set `lastrefresh`= %s_date, `con` = `con`+%d_cnt, `connect`= `connect`+ %d_cnt, '\
|
||||
'`refcnt` = `refcnt` + %d_cnt, `refresh` = `refresh` + %d_cnt where `no` =%i_generalID",array(
|
||||
'date'=>$date,
|
||||
'cnt'=>$cnt,
|
||||
'p_id'=>$generalID
|
||||
'generalID'=>$generalID
|
||||
));
|
||||
}
|
||||
|
||||
@@ -2311,9 +2308,9 @@ function increaseRefresh($connect, $type="", $cnt=1) {
|
||||
$query = "update game set refresh=refresh+'$cnt' where no='1'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
if($_SESSION['p_id'] != "") {
|
||||
$query = sprintf("update general set lastrefresh='%s',con=con+'%d',connect=connect+'%d',refcnt=refcnt+'%d',refresh=refresh+'%d' where user_id='%s'",
|
||||
$date,$cnt,$cnt,$cnt,$cnt,$_SESSION['p_id']);
|
||||
if($_SESSION['noMember'] != "") {
|
||||
$query = sprintf("update general set lastrefresh='%s',con=con+'%d',connect=connect+'%d',refcnt=refcnt+'%d',refresh=refresh+'%d' where no_member='%d'",
|
||||
$date,$cnt,$cnt,$cnt,$cnt,$_SESSION['noMember']);
|
||||
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
@@ -2322,7 +2319,7 @@ function increaseRefresh($connect, $type="", $cnt=1) {
|
||||
$date2 = substr($date, 0, 10);
|
||||
$online = getOnlineNum();
|
||||
$fp = fopen("logs/_{$date2}_refresh.txt", "a");
|
||||
$msg = _String::Fill2($date,20," ")._String::Fill2($_SESSION['p_id'],13," ")._String::Fill2($_SESSION['p_name'],13," ")._String::Fill2($_SESSION['p_ip'],16," ")._String::Fill2($type, 10, " ")." 동접자: {$online}";
|
||||
$msg = _String::Fill2($date,20," ")._String::Fill2($_SESSION['noMember'],13," ")._String::Fill2($_SESSION['p_name'],13," ")._String::Fill2($_SESSION['p_ip'],16," ")._String::Fill2($type, 10, " ")." 동접자: {$online}";
|
||||
fwrite($fp, $msg."\n");
|
||||
fclose($fp);
|
||||
|
||||
@@ -2351,7 +2348,7 @@ function increaseRefresh($connect, $type="", $cnt=1) {
|
||||
if($str != "") {
|
||||
file_put_contents("logs/_{$date2}_ipcheck.txt",
|
||||
sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s\n",
|
||||
$_SESSION['p_id'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND);
|
||||
$_SESSION['noMember'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2573,7 +2570,7 @@ function checkTurn($connect) {
|
||||
return;
|
||||
}
|
||||
|
||||
$locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$_SESSION['p_id'];
|
||||
$locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$_SESSION['noMember'];
|
||||
pushLockLog($connect, $locklog);
|
||||
|
||||
// 파일락 해제
|
||||
@@ -2581,7 +2578,7 @@ function checkTurn($connect) {
|
||||
// 세마포어 해제
|
||||
//if(!@sem_release($sema)) { echo "치명적 에러! 유기체에게 문의하세요!"; exit(1); }
|
||||
|
||||
$locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$_SESSION['p_id'];
|
||||
$locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$_SESSION['noMember'];
|
||||
pushLockLog($connect, $locklog);
|
||||
|
||||
//if(STEP_LOG) delStepLog();
|
||||
@@ -2647,7 +2644,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['p_id'];
|
||||
$locklog[0] = "-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['noMember'];
|
||||
pushLockLog($connect, $locklog);
|
||||
|
||||
// 잡금 해제
|
||||
@@ -2660,7 +2657,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['p_id'];
|
||||
$locklog[0] = "-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$_SESSION['noMember'];
|
||||
pushLockLog($connect, $locklog);
|
||||
// 분기계산. 장수들 턴보다 먼저 있다면 먼저처리
|
||||
if($admin['month'] == 1) {
|
||||
@@ -2776,7 +2773,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['p_id'];
|
||||
$locklog[0] = "- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['noMember'];
|
||||
pushLockLog($connect, $locklog);
|
||||
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', finish');
|
||||
@@ -4350,7 +4347,7 @@ function getAdmin($connect) {
|
||||
}
|
||||
|
||||
function getMe($connect) {
|
||||
$query = "select * from general where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select * from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error("접속자가 많아 접속을 중단합니다. 잠시후 갱신해주세요.<br>getMe : ".MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -4750,7 +4747,7 @@ function command_Single($connect, $turn, $command) {
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$str .= ",turn{$turn[$i]}='{$command}'";
|
||||
}
|
||||
$query = "update general set {$str} where user_id='{$_SESSION['p_id']}'";
|
||||
$query = "update general set {$str} where no_member='{$_SESSION['noMember']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//echo "<script>location.replace('commandlist.php');</script>";
|
||||
echo 'commandlist.php';//TODO:debug all and replace
|
||||
@@ -4760,7 +4757,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 user_id='{$_SESSION['p_id']}'";
|
||||
$query = "select nation,level from general where no_member='{$_SESSION['noMember']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user