From d080e5ec2c6b16c6e5e06effb26529885316621f Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 21 Jan 2018 16:58:19 +0900 Subject: [PATCH] =?UTF-8?q?\r\n=EC=9D=84=20\n=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD.=20=EB=A9=94=EB=AA=A8=EC=9E=A5=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=97=B4=20=EA=B2=83=EB=8F=84=20=EC=95=84=EB=8B=88?= =?UTF-8?q?=EA=B3=A0..=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=99=95=EC=9D=B8?= =?UTF-8?q?=20=EB=93=B1=20=EB=AA=87=EB=AA=87=20=EC=9C=A0=ED=8B=B8=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=83=88=20db=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EA=B8=B0=EC=A4=80=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80=20ajax=20=EA=B8=B0=EB=B0=98=20ms?= =?UTF-8?q?gsubmit=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f_func/class._Chat.php | 4 +- f_func/class._Log.php | 4 +- f_func/func.php | 4 +- twe/a_traffic.php | 2 +- twe/c_msgsubmit.php | 2 +- twe/error.php | 4 +- twe/func.php | 117 ++++++++++++++++++++++++++++++-------- twe/func_history.php | 2 +- twe/func_http.php | 34 +++++------ twe/func_tournament.php | 4 +- twe/j_msgsubmit.php | 63 ++++++++++++++------ twe/npc_login_process.php | 2 +- 12 files changed, 168 insertions(+), 74 deletions(-) diff --git a/f_func/class._Chat.php b/f_func/class._Chat.php index 1ada9fc6..c2300d37 100644 --- a/f_func/class._Chat.php +++ b/f_func/class._Chat.php @@ -7,13 +7,13 @@ require_once(ROOT.W.F_FUNC.W.'class._JSON.php'); class _Chat { public static function SetChat($type, $name, $msg) { $filename = ROOT.W.D_CHAT.W.$type."Chat.txt"; - AppendToFile($filename, "{$name}: {$msg}\r\n"); + AppendToFile($filename, "{$name}: {$msg}\n"); } public static function GetChat($type, $size=10) { $filename = ROOT.W.D_CHAT.W.$type."Chat.txt"; $content = ReadToFileBackward($filename, $size*100); - $msgs = explode("\r\n", $content); + $msgs = explode("\n", $content); $count = count($msgs) - 1; $start = $count - $size; if($start < 0) $start = 0; diff --git a/f_func/class._Log.php b/f_func/class._Log.php index 6c3b8bec..ed90cae0 100644 --- a/f_func/class._Log.php +++ b/f_func/class._Log.php @@ -10,14 +10,14 @@ class _Log { public static function SetLog($type, $log) { $filename = ROOT.W.D_LOG.W.$type."Log.txt"; - if(_Log::$flagLog) AppendToFile($filename, $log."\r\n"); + if(_Log::$flagLog) AppendToFile($filename, $log."\n"); } public static function GetWorldLog($type, $size=10) { $filename = ROOT.W.D_LOG.W.$type."Log.txt"; if(_Log::$flagLog) { $content = ReadToFileBackward($filename, $size*150); - $logs = explode("\r\n", $content); + $logs = explode("\n", $content); $count = count($logs) - 1; $start = $count - $size; if($start < 0) $start = 0; diff --git a/f_func/func.php b/f_func/func.php index 4d8a4377..49ac51b9 100644 --- a/f_func/func.php +++ b/f_func/func.php @@ -18,12 +18,12 @@ function getmicrotime() { } function Error($msg) { - AppendToFile(ROOT.'/d_log/err.txt', $msg."\r\n"); + AppendToFile(ROOT.'/d_log/err.txt', $msg."\n"); exit(1); } function ErrorToScreen($msg) { - AppendToFile(ROOT.'/d_log/err.txt', $msg."\r\n"); + AppendToFile(ROOT.'/d_log/err.txt', $msg."\n"); echo $msg; exit(1); } diff --git a/twe/a_traffic.php b/twe/a_traffic.php index efa0a8ef..54429946 100644 --- a/twe/a_traffic.php +++ b/twe/a_traffic.php @@ -12,7 +12,7 @@ $fp = @fopen("logs/_traffic.txt", "r"); @fseek($fp, -1000, SEEK_END); $file = @fread($fp, 1000); @fclose($fp); -$log = explode("\r\n",$file); +$log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."
"; } echo $str; diff --git a/twe/c_msgsubmit.php b/twe/c_msgsubmit.php index ae0f234d..92aa2c0d 100644 --- a/twe/c_msgsubmit.php +++ b/twe/c_msgsubmit.php @@ -130,7 +130,7 @@ if($genlist == 9999 && str_replace(" ", "", $msg) != "") { $fp = fopen("logs/_gen_msg.txt", "a"); //로그 파일에 기록 - fwrite($fp, _String::Fill($me['name'],12," ")." > "._String::Fill($you['name'],12," ")." | {$msg}\r\n"); + fwrite($fp, _String::Fill($me['name'],12," ")." > "._String::Fill($you['name'],12," ")." | {$msg}\n"); fclose($fp); } diff --git a/twe/error.php b/twe/error.php index e715fc70..10c73c93 100644 --- a/twe/error.php +++ b/twe/error.php @@ -1,7 +1,5 @@ diff --git a/twe/func.php b/twe/func.php index d52daf1c..aa6d759e 100644 --- a/twe/func.php +++ b/twe/func.php @@ -115,17 +115,27 @@ function GetImageURL($imgsvr) { function CheckLogin($type=0) { if(!isset($_SESSION['p_id'])) { if($type == 0) { + header('Location: start.php'); //echo ""; - echo 'start.php';//TODO:debug all and replace + //echo 'start.php';//TODO:debug all and replace } else { - echo 'main.php';//TODO:debug all and replace + header('Location: main.php'); + //echo 'main.php';//TODO:debug all and replace //echo ""; } exit(); } } +function CheckLoginEx(){ + //TODO: 서버 별로 p_id를 다르게 설정할 수 있어야함. + if(!isset($_SESSION['p_id'])) { + return false; + } + return true; +} + function checkLimit($userlevel, $con, $conlimit) { //운영자 if($userlevel >= 5) { return 0; } @@ -2882,7 +2892,7 @@ function pushTrickLog($connect, $log) { if($size > 0) { $fp = fopen("logs/_tricklog.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2894,7 +2904,7 @@ function pushProcessLog($connect, $log) { $date = date('Y_m_d'); $fp = fopen("logs/_{$date}_processlog.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2908,7 +2918,7 @@ function delStepLog() { function pushStepLog($log) { $date = date('Y_m_d'); $fp = fopen("logs/_{$date}_steplog.txt", "a"); - fwrite($fp, $log."\r\n"); + fwrite($fp, $log."\n"); fclose($fp); } @@ -2918,7 +2928,7 @@ function pushLockLog($connect, $log) { $date = date('Y_m_d'); $fp = fopen("logs/_{$date}_locklog.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2929,7 +2939,7 @@ function pushAdminLog($connect, $log) { if($size > 0) { $fp = fopen("logs/_adminlog.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2940,7 +2950,7 @@ function pushAuctionLog($connect, $log) { if($size > 0) { $fp = fopen("logs/_auctionlog.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2951,7 +2961,7 @@ function pushGenLog($general, $log) { if($size > 0) { $fp = fopen("logs/gen{$general['no']}.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2962,7 +2972,7 @@ function pushBatRes($general, $log) { if($size > 0) { $fp = fopen("logs/batres{$general['no']}.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2973,7 +2983,7 @@ function pushBatLog($general, $log) { if($size > 0) { $fp = fopen("logs/batlog{$general['no']}.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2984,7 +2994,7 @@ function pushAllLog($log) { if($size > 0) { $fp = fopen("logs/_alllog.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } @@ -2995,12 +3005,24 @@ function pushHistory($connect, $history) { if($size > 0) { $fp = fopen("logs/_history.txt", "a"); for($i=0; $i < $size; $i++) { - fwrite($fp, $history[$i]."\r\n"); + fwrite($fp, $history[$i]."\n"); } fclose($fp); } } +function getRawLog($path, $count, $line_length, $skin){ + //TODO: tail과 유사한 형태로 처리할 수 있는게 나을 듯. 그 이전에 파일 로그는 좀... ㅜㅜ + if(!file_exists($path)){ + return NULL; + } + + $fp = fopen($path, 'r'); + @fseek(fp, -$count * $line_length, SEEK_END); + $data = fread($fp, $count * $line_length); + fclose($fp); +} + function TrickLog($count, $skin) { if(!file_exists("logs/_tricklog.txt")){ return ''; @@ -3009,7 +3031,7 @@ function TrickLog($count, $skin) { @fseek($fp, -$count*150, SEEK_END); $file = @fread($fp, $count*150); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."
"; } echo $str; @@ -3023,7 +3045,7 @@ function AllLog($count, $skin) { @fseek($fp, -$count*300, SEEK_END); $file = @fread($fp, $count*300); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."
" : "
"; @@ -3039,7 +3061,7 @@ function AuctionLog($count, $skin) { @fseek($fp, -$count*300, SEEK_END); $file = @fread($fp, $count*300); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."
"; } echo $str; @@ -3053,7 +3075,7 @@ function History($count, $skin) { @fseek($fp, -300*$count, SEEK_END); // $file = @fread($fp, $count*300); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."
" : "
"; @@ -3069,7 +3091,7 @@ function MyLog($no, $count, $skin) { @fseek($fp, -$count*300, SEEK_END); $file = @fread($fp, $count*300); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."
" : "
"; @@ -3085,7 +3107,7 @@ function MyBatRes($no, $count, $skin) { @fseek($fp, -$count*300, SEEK_END); $file = @fread($fp, $count*300); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."
" : "
"; @@ -3101,7 +3123,7 @@ function MyBatLog($no, $count, $skin) { @fseek($fp, -$count*300, SEEK_END); $file = @fread($fp, $count*300); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; for($i=0; $i < $count; $i++) { $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."
" : "
"; @@ -3179,6 +3201,16 @@ function allButton($connect) { "; } +function getOnlineNumEx($db = NULL){ + if($db === NULL){ + $db = newDB(); + } + + return $db->queryFirstField('select `online` from `game` where `no`=1'); +} + + + function onlinenum($connect) { $query = "select online from game where no='1'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -3517,6 +3549,43 @@ function CutDay($date) { return $date; } +function getPID(){ + //TODO: 서버마다 p_id가 다를 수 있도록 조치 + if(!isset($_SESSION['p_id'])){ + return NULL; + } + if($_SESSION['p_id']===''){ + return NULL; + } + return $_SESSION['p_id']; +} + +function increateRefreshEx($type, $cnt=1, $db=NULL){ + + if($db === NULL){ + $db = newDB(); + } + + $db->query("update `game` set `refresh` = `refresh` + %d_p_id where `no` = %d_cnt", array( + 'p_id'=>$p_id, + 'cnt'=>$cnt + )); + + $date = date('Y-m-d H:i:s'); + $p_id = getPID(); + if($p_id !== 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 `user_id` =%s_p_id",array( + 'date'=>$date, + 'cnt'=>$cnt, + 'p_id'=>$p_id + )); + } + + +} + function increaseRefresh($connect, $type="", $cnt=1) { $date = date('Y-m-d H:i:s'); @@ -3561,11 +3630,9 @@ function increaseRefresh($connect, $type="", $cnt=1) { if(isset($_SERVER[$x])) $str .= "//{$x}:{$_SERVER[$x]}"; } if($str != "") { - $fp2 = fopen("logs/_{$date2}_ipcheck.txt", "a"); - $str = sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s", - $_SESSION['p_id'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str); - fwrite($fp2, $str."\r\n"); - fclose($fp2); + file_put_contents("logs/_{$date2}_ipcheck.txt", + sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s\r\n", + $_SESSION['p_id'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND); } } diff --git a/twe/func_history.php b/twe/func_history.php index 35ce714c..6c87c1f7 100644 --- a/twe/func_history.php +++ b/twe/func_history.php @@ -34,7 +34,7 @@ function getGenHistory($count, $year, $month, $isFirst=0) { @fseek($fp, -$count*300, SEEK_END); $file = @fread($fp, $count*300); @fclose($fp); - $log = explode("\r\n",$file); + $log = explode("\n",$file); $str = ""; $prefix = "{$month}월:"; diff --git a/twe/func_http.php b/twe/func_http.php index c809b579..75666281 100644 --- a/twe/func_http.php +++ b/twe/func_http.php @@ -27,7 +27,7 @@ class HTTP{ function Head($Url = "/") { $this->Url = $Url; - $msg = sprintf("HEAD %s HTTP/%s\r\n", $this->Url, $this->HttpVersion); + $msg = sprintf("HEAD %s HTTP/%s\n", $this->Url, $this->HttpVersion); $msg .= $this->PutHead(); $msg .= "\n\n"; fputs($this->Socket, $msg); @@ -37,7 +37,7 @@ class HTTP{ function isHead($Url = "/"){ $this->Url = $Url; - $msg = sprintf("HEAD %s HTTP/%s\r\n", $this->Url, $this->HttpVersion); + $msg = sprintf("HEAD %s HTTP/%s\n", $this->Url, $this->HttpVersion); if($Cookie != ""){ $msg .= $this->PutCookie($Cookie); } @@ -50,7 +50,7 @@ class HTTP{ function GetHead($Url = "/") { $this->Url = $Url; - $msg = sprintf("GET %s HTTP/%s\r\n", $this->Url, $this->HttpVersion); + $msg = sprintf("GET %s HTTP/%s\n", $this->Url, $this->HttpVersion); $msg .= $this->PutHead(); $msg .= "\n\n"; fputs($this->Socket, $msg); @@ -60,7 +60,7 @@ class HTTP{ function Get($Url = "/", $Cookie="") { $this->Url = $Url; - $msg = sprintf("GET %s HTTP/%s\r\n", $this->Url, $this->HttpVersion); + $msg = sprintf("GET %s HTTP/%s\n", $this->Url, $this->HttpVersion); if($Cookie != ""){ $msg .= $this->PutCookie($Cookie); } @@ -72,7 +72,7 @@ class HTTP{ function isGet($Url = "/", $Cookie=""){ $this->Url = $Url; - $msg = sprintf("GET %s HTTP/%s\r\n", $this->Url, $this->HttpVersion); + $msg = sprintf("GET %s HTTP/%s\n", $this->Url, $this->HttpVersion); if($Cookie != ""){ $msg .= $this->PutCookie($Cookie); } @@ -84,7 +84,7 @@ class HTTP{ function isGetAll($Url = "/", $Cookie=""){ $this->Url = $Url; - $msg = sprintf("GET %s HTTP/%s\r\n", $this->Url, $this->HttpVersion); + $msg = sprintf("GET %s HTTP/%s\n", $this->Url, $this->HttpVersion); if($Cookie != ""){ $msg .= $this->PutCookie($Cookie); } @@ -99,12 +99,12 @@ class HTTP{ function Post($Url, $Data, $Cookie = ""){ $this->Url = $Url; - fputs ($this->Socket,sprintf("POST %s HTTP/%s\r\n", $this->Url, $this->HttpVersion)); + fputs ($this->Socket,sprintf("POST %s HTTP/%s\n", $this->Url, $this->HttpVersion)); if($Cookie != ""){ $this->PutCookie($Cookie); } $this->PutHead(); - fputs ($this->Socket, "Content-type: application/x-www-form-urlencoded\r\n"); + fputs ($this->Socket, "Content-type: application/x-www-form-urlencoded\n"); $out = ""; while (list ($k, $v) = each ($Data)) { if(strlen($out) != 0) $out .= "&"; @@ -118,12 +118,12 @@ class HTTP{ function IsPost($Url, $Data, $Cookie = ""){ $this->Url = $Url; - fputs ($this->Socket,sprintf("POST %s HTTP/%s\r\n", $this->Url, $this->HttpVersion)); + fputs ($this->Socket,sprintf("POST %s HTTP/%s\n", $this->Url, $this->HttpVersion)); if($Cookie != ""){ $this->PutCookie($Cookie); } $this->PutHead(); - fputs ($this->Socket, "Content-type: application/x-www-form-urlencoded\r\n"); + fputs ($this->Socket, "Content-type: application/x-www-form-urlencoded\n"); $out = ""; while (list ($k, $v) = each ($Data)) { if(strlen($out) != 0) $out .= "&"; @@ -137,15 +137,15 @@ class HTTP{ function PutHead(){ $msg = ""; - $msg .= "Accept: */*\r\n"; - $msg .= "Accept-Language: ko\r\n"; - $msg .= "Accept-Encoding: gzip, deflate\r\n"; - $msg .= "User-Agent: Mozilla/4.0 (compatible; 62che)\r\n"; + $msg .= "Accept: */*\n"; + $msg .= "Accept-Language: ko\n"; + $msg .= "Accept-Encoding: gzip, deflate\n"; + $msg .= "User-Agent: Mozilla/4.0 (compatible; 62che)\n"; while (list($name, $value) = each ($this->headers)) { - $msg .= "$name: $value\r\n"; + $msg .= "$name: $value\n"; } - $msg .= "Host: ".$this->Server.":".$this->Port."\r\n"; - $msg .= "Connection: close\r\n"; + $msg .= "Host: ".$this->Server.":".$this->Port."\n"; + $msg .= "Connection: close\n"; return $msg; } diff --git a/twe/func_tournament.php b/twe/func_tournament.php index 3e3810bb..8f9c8412 100644 --- a/twe/func_tournament.php +++ b/twe/func_tournament.php @@ -169,7 +169,7 @@ function printFightLog($group) { $fp = @fopen("logs/fight{$group}.txt", "r"); $file = @fread($fp, 3000); @fclose($fp); - $log = explode("\r\n", $file); + $log = explode("\n", $file); $str = ""; for($i=0; $i < count($log); $i++) { $str .= ConvertLog($log[$i], 1)."
"; } return substr($str, 0, -4); @@ -179,7 +179,7 @@ function pushFightLog($group, $log) { $fp = fopen("logs/fight{$group}.txt", "w"); $size = count($log); for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\r\n"); + fwrite($fp, $log[$i]."\n"); } fclose($fp); } diff --git a/twe/j_msgsubmit.php b/twe/j_msgsubmit.php index 47ed124d..417209b3 100644 --- a/twe/j_msgsubmit.php +++ b/twe/j_msgsubmit.php @@ -3,35 +3,64 @@ include "lib.php"; include "func.php"; +require_once('func_message.php'); + + +$post = parseJsonPost(); + +if(!isset($post['genlist']) || !isset($post['msg'])){ + header('Content-Type: application/json'); + die(json_encode([ + 'result' => false, + 'reason' => '올바르지 않은 호출입니다.', + 'redirect' => NULL + ])); +} + + +$genlist = $post['genlist']; +$msg = $post['msg']; + //로그인 검사 -CheckLogin(1); +if(!CheckLoginEx()){ + header('Content-Type: application/json'); + die(json_encode([ + 'result' => false, + 'reason' => '로그인되지 않았습니다.', + 'redirect' => NULL + ])); +} + $connect = dbConn(); increaseRefresh($connect, "서신전달", 1); +//$msg,$genlist 두가지 값을 받 + if(CheckBlock($connect) == 1 || CheckBlock($connect) == 3) { - $msg = ""; - $genlist = 0; + header('Content-Type: application/json'); + die(json_encode([ + 'result' => false, + 'reason' => '차단되었습니다.', + 'redirect' => NULL + ])); } -$query = "select conlimit from game where no=1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$admin = MYDB_fetch_array($result); +$db = newDB(); -$query = "select no,name,nation,level,msgindex,userlevel,con,picture,imgsvr from general where user_id='{$_SESSION['p_id']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); -$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']); +$conlimit = $db->queryFirstField("select conlimit from game where no=1"); + +$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`msgindex`,`userlevel`,`con`,`picture`,`imgsvr` from `general` where `user_id` = %s_p_id', + array('p_id'=>$_SESSION['p_id'])); + +$con = checkLimit($me['userlevel'], $me['con'], $conlimit); if($con >= 2) { - //echo ""; exit(); header('Content-Type: application/json'); - echo json_encode([ + die(json_encode([ 'result' => false, - 'reason' => '권한이 충분하지 않습니다.', - 'redirect' => 'main.php', - 'page_target' => 'top' - ]); - //echo 'main.php';//TODO:debug all and replace + 'reason' => '접속 제한입니다.', + 'redirect' => NULL + ])); } $msg = str_replace("|", "", $msg); diff --git a/twe/npc_login_process.php b/twe/npc_login_process.php index 9358d137..b45a79f7 100644 --- a/twe/npc_login_process.php +++ b/twe/npc_login_process.php @@ -55,7 +55,7 @@ if(!$me2) { $date2 = substr($date, 0, 10); $fp = fopen("logs/_{$date2}-login.txt", "a"); $msg = _String::Fill2($date,20," ")._String::Fill2($id,13," ")._String::Fill2($me['name'],13," ")._String::Fill2($_SESSION['p_ip'],16," "); - fwrite($fp, $msg."\r\n"); + fwrite($fp, $msg."\n"); fclose($fp); }