\r\n을 \n으로 변경. 메모장에서 열 것도 아니고..
로그인 확인 등 몇몇 유틸 함수 새 db 라이브러리 기준으로 추가 ajax 기반 msgsubmit 작업중
This commit is contained in:
@@ -7,13 +7,13 @@ require_once(ROOT.W.F_FUNC.W.'class._JSON.php');
|
|||||||
class _Chat {
|
class _Chat {
|
||||||
public static function SetChat($type, $name, $msg) {
|
public static function SetChat($type, $name, $msg) {
|
||||||
$filename = ROOT.W.D_CHAT.W.$type."Chat.txt";
|
$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) {
|
public static function GetChat($type, $size=10) {
|
||||||
$filename = ROOT.W.D_CHAT.W.$type."Chat.txt";
|
$filename = ROOT.W.D_CHAT.W.$type."Chat.txt";
|
||||||
$content = ReadToFileBackward($filename, $size*100);
|
$content = ReadToFileBackward($filename, $size*100);
|
||||||
$msgs = explode("\r\n", $content);
|
$msgs = explode("\n", $content);
|
||||||
$count = count($msgs) - 1;
|
$count = count($msgs) - 1;
|
||||||
$start = $count - $size;
|
$start = $count - $size;
|
||||||
if($start < 0) $start = 0;
|
if($start < 0) $start = 0;
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ class _Log {
|
|||||||
|
|
||||||
public static function SetLog($type, $log) {
|
public static function SetLog($type, $log) {
|
||||||
$filename = ROOT.W.D_LOG.W.$type."Log.txt";
|
$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) {
|
public static function GetWorldLog($type, $size=10) {
|
||||||
$filename = ROOT.W.D_LOG.W.$type."Log.txt";
|
$filename = ROOT.W.D_LOG.W.$type."Log.txt";
|
||||||
if(_Log::$flagLog) {
|
if(_Log::$flagLog) {
|
||||||
$content = ReadToFileBackward($filename, $size*150);
|
$content = ReadToFileBackward($filename, $size*150);
|
||||||
$logs = explode("\r\n", $content);
|
$logs = explode("\n", $content);
|
||||||
$count = count($logs) - 1;
|
$count = count($logs) - 1;
|
||||||
$start = $count - $size;
|
$start = $count - $size;
|
||||||
if($start < 0) $start = 0;
|
if($start < 0) $start = 0;
|
||||||
|
|||||||
+2
-2
@@ -18,12 +18,12 @@ function getmicrotime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Error($msg) {
|
function Error($msg) {
|
||||||
AppendToFile(ROOT.'/d_log/err.txt', $msg."\r\n");
|
AppendToFile(ROOT.'/d_log/err.txt', $msg."\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ErrorToScreen($msg) {
|
function ErrorToScreen($msg) {
|
||||||
AppendToFile(ROOT.'/d_log/err.txt', $msg."\r\n");
|
AppendToFile(ROOT.'/d_log/err.txt', $msg."\n");
|
||||||
echo $msg;
|
echo $msg;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ $fp = @fopen("logs/_traffic.txt", "r");
|
|||||||
@fseek($fp, -1000, SEEK_END);
|
@fseek($fp, -1000, SEEK_END);
|
||||||
$file = @fread($fp, 1000);
|
$file = @fread($fp, 1000);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."<br>"; }
|
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."<br>"; }
|
||||||
echo $str;
|
echo $str;
|
||||||
|
|||||||
+1
-1
@@ -130,7 +130,7 @@ if($genlist == 9999 && str_replace(" ", "", $msg) != "") {
|
|||||||
|
|
||||||
$fp = fopen("logs/_gen_msg.txt", "a");
|
$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);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
$fp = fopen("logs/_db_bug.txt", "a");
|
file_put_contents("logs/_db_bug.txt", $message."\n", FILE_APPEND);
|
||||||
fwrite($fp, $message."\r\n");
|
|
||||||
fclose($fp);
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
|
|||||||
+92
-25
@@ -115,17 +115,27 @@ function GetImageURL($imgsvr) {
|
|||||||
function CheckLogin($type=0) {
|
function CheckLogin($type=0) {
|
||||||
if(!isset($_SESSION['p_id'])) {
|
if(!isset($_SESSION['p_id'])) {
|
||||||
if($type == 0) {
|
if($type == 0) {
|
||||||
|
header('Location: start.php');
|
||||||
//echo "<script>location.replace('start.php');</script>";
|
//echo "<script>location.replace('start.php');</script>";
|
||||||
echo 'start.php';//TODO:debug all and replace
|
//echo 'start.php';//TODO:debug all and replace
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo 'main.php';//TODO:debug all and replace
|
header('Location: main.php');
|
||||||
|
//echo 'main.php';//TODO:debug all and replace
|
||||||
//echo "<script>window.top.main.location.replace('main.php');</script>";
|
//echo "<script>window.top.main.location.replace('main.php');</script>";
|
||||||
}
|
}
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CheckLoginEx(){
|
||||||
|
//TODO: 서버 별로 p_id를 다르게 설정할 수 있어야함.
|
||||||
|
if(!isset($_SESSION['p_id'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function checkLimit($userlevel, $con, $conlimit) {
|
function checkLimit($userlevel, $con, $conlimit) {
|
||||||
//운영자
|
//운영자
|
||||||
if($userlevel >= 5) { return 0; }
|
if($userlevel >= 5) { return 0; }
|
||||||
@@ -2882,7 +2892,7 @@ function pushTrickLog($connect, $log) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/_tricklog.txt", "a");
|
$fp = fopen("logs/_tricklog.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2894,7 +2904,7 @@ function pushProcessLog($connect, $log) {
|
|||||||
$date = date('Y_m_d');
|
$date = date('Y_m_d');
|
||||||
$fp = fopen("logs/_{$date}_processlog.txt", "a");
|
$fp = fopen("logs/_{$date}_processlog.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2908,7 +2918,7 @@ function delStepLog() {
|
|||||||
function pushStepLog($log) {
|
function pushStepLog($log) {
|
||||||
$date = date('Y_m_d');
|
$date = date('Y_m_d');
|
||||||
$fp = fopen("logs/_{$date}_steplog.txt", "a");
|
$fp = fopen("logs/_{$date}_steplog.txt", "a");
|
||||||
fwrite($fp, $log."\r\n");
|
fwrite($fp, $log."\n");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2918,7 +2928,7 @@ function pushLockLog($connect, $log) {
|
|||||||
$date = date('Y_m_d');
|
$date = date('Y_m_d');
|
||||||
$fp = fopen("logs/_{$date}_locklog.txt", "a");
|
$fp = fopen("logs/_{$date}_locklog.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2929,7 +2939,7 @@ function pushAdminLog($connect, $log) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/_adminlog.txt", "a");
|
$fp = fopen("logs/_adminlog.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2940,7 +2950,7 @@ function pushAuctionLog($connect, $log) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/_auctionlog.txt", "a");
|
$fp = fopen("logs/_auctionlog.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2951,7 +2961,7 @@ function pushGenLog($general, $log) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/gen{$general['no']}.txt", "a");
|
$fp = fopen("logs/gen{$general['no']}.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2962,7 +2972,7 @@ function pushBatRes($general, $log) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/batres{$general['no']}.txt", "a");
|
$fp = fopen("logs/batres{$general['no']}.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2973,7 +2983,7 @@ function pushBatLog($general, $log) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/batlog{$general['no']}.txt", "a");
|
$fp = fopen("logs/batlog{$general['no']}.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2984,7 +2994,7 @@ function pushAllLog($log) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/_alllog.txt", "a");
|
$fp = fopen("logs/_alllog.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
@@ -2995,12 +3005,24 @@ function pushHistory($connect, $history) {
|
|||||||
if($size > 0) {
|
if($size > 0) {
|
||||||
$fp = fopen("logs/_history.txt", "a");
|
$fp = fopen("logs/_history.txt", "a");
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $history[$i]."\r\n");
|
fwrite($fp, $history[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
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) {
|
function TrickLog($count, $skin) {
|
||||||
if(!file_exists("logs/_tricklog.txt")){
|
if(!file_exists("logs/_tricklog.txt")){
|
||||||
return '';
|
return '';
|
||||||
@@ -3009,7 +3031,7 @@ function TrickLog($count, $skin) {
|
|||||||
@fseek($fp, -$count*150, SEEK_END);
|
@fseek($fp, -$count*150, SEEK_END);
|
||||||
$file = @fread($fp, $count*150);
|
$file = @fread($fp, $count*150);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."<br>"; }
|
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."<br>"; }
|
||||||
echo $str;
|
echo $str;
|
||||||
@@ -3023,7 +3045,7 @@ function AllLog($count, $skin) {
|
|||||||
@fseek($fp, -$count*300, SEEK_END);
|
@fseek($fp, -$count*300, SEEK_END);
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) {
|
for($i=0; $i < $count; $i++) {
|
||||||
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
||||||
@@ -3039,7 +3061,7 @@ function AuctionLog($count, $skin) {
|
|||||||
@fseek($fp, -$count*300, SEEK_END);
|
@fseek($fp, -$count*300, SEEK_END);
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."<br>"; }
|
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i], $skin)."<br>"; }
|
||||||
echo $str;
|
echo $str;
|
||||||
@@ -3053,7 +3075,7 @@ function History($count, $skin) {
|
|||||||
@fseek($fp, -300*$count, SEEK_END); //
|
@fseek($fp, -300*$count, SEEK_END); //
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) {
|
for($i=0; $i < $count; $i++) {
|
||||||
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
||||||
@@ -3069,7 +3091,7 @@ function MyLog($no, $count, $skin) {
|
|||||||
@fseek($fp, -$count*300, SEEK_END);
|
@fseek($fp, -$count*300, SEEK_END);
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) {
|
for($i=0; $i < $count; $i++) {
|
||||||
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
||||||
@@ -3085,7 +3107,7 @@ function MyBatRes($no, $count, $skin) {
|
|||||||
@fseek($fp, -$count*300, SEEK_END);
|
@fseek($fp, -$count*300, SEEK_END);
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) {
|
for($i=0; $i < $count; $i++) {
|
||||||
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
||||||
@@ -3101,7 +3123,7 @@ function MyBatLog($no, $count, $skin) {
|
|||||||
@fseek($fp, -$count*300, SEEK_END);
|
@fseek($fp, -$count*300, SEEK_END);
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < $count; $i++) {
|
for($i=0; $i < $count; $i++) {
|
||||||
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i], $skin)."<br>" : "<br>";
|
||||||
@@ -3179,6 +3201,16 @@ function allButton($connect) {
|
|||||||
</table>";
|
</table>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOnlineNumEx($db = NULL){
|
||||||
|
if($db === NULL){
|
||||||
|
$db = newDB();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $db->queryFirstField('select `online` from `game` where `no`=1');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onlinenum($connect) {
|
function onlinenum($connect) {
|
||||||
$query = "select online from game where no='1'";
|
$query = "select online from game where no='1'";
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
@@ -3517,6 +3549,43 @@ function CutDay($date) {
|
|||||||
return $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) {
|
function increaseRefresh($connect, $type="", $cnt=1) {
|
||||||
$date = date('Y-m-d H:i:s');
|
$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(isset($_SERVER[$x])) $str .= "//{$x}:{$_SERVER[$x]}";
|
||||||
}
|
}
|
||||||
if($str != "") {
|
if($str != "") {
|
||||||
$fp2 = fopen("logs/_{$date2}_ipcheck.txt", "a");
|
file_put_contents("logs/_{$date2}_ipcheck.txt",
|
||||||
$str = sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s",
|
sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s\r\n",
|
||||||
$_SESSION['p_id'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str);
|
$_SESSION['p_id'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND);
|
||||||
fwrite($fp2, $str."\r\n");
|
|
||||||
fclose($fp2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function getGenHistory($count, $year, $month, $isFirst=0) {
|
|||||||
@fseek($fp, -$count*300, SEEK_END);
|
@fseek($fp, -$count*300, SEEK_END);
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n",$file);
|
$log = explode("\n",$file);
|
||||||
|
|
||||||
$str = "";
|
$str = "";
|
||||||
$prefix = "</>{$month}월:";
|
$prefix = "</>{$month}월:";
|
||||||
|
|||||||
+17
-17
@@ -27,7 +27,7 @@ class HTTP{
|
|||||||
|
|
||||||
function Head($Url = "/") {
|
function Head($Url = "/") {
|
||||||
$this->Url = $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 .= $this->PutHead();
|
||||||
$msg .= "\n\n";
|
$msg .= "\n\n";
|
||||||
fputs($this->Socket, $msg);
|
fputs($this->Socket, $msg);
|
||||||
@@ -37,7 +37,7 @@ class HTTP{
|
|||||||
|
|
||||||
function isHead($Url = "/"){
|
function isHead($Url = "/"){
|
||||||
$this->Url = $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 != ""){
|
if($Cookie != ""){
|
||||||
$msg .= $this->PutCookie($Cookie);
|
$msg .= $this->PutCookie($Cookie);
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ class HTTP{
|
|||||||
|
|
||||||
function GetHead($Url = "/") {
|
function GetHead($Url = "/") {
|
||||||
$this->Url = $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 .= $this->PutHead();
|
||||||
$msg .= "\n\n";
|
$msg .= "\n\n";
|
||||||
fputs($this->Socket, $msg);
|
fputs($this->Socket, $msg);
|
||||||
@@ -60,7 +60,7 @@ class HTTP{
|
|||||||
|
|
||||||
function Get($Url = "/", $Cookie="") {
|
function Get($Url = "/", $Cookie="") {
|
||||||
$this->Url = $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);
|
||||||
if($Cookie != ""){
|
if($Cookie != ""){
|
||||||
$msg .= $this->PutCookie($Cookie);
|
$msg .= $this->PutCookie($Cookie);
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ class HTTP{
|
|||||||
|
|
||||||
function isGet($Url = "/", $Cookie=""){
|
function isGet($Url = "/", $Cookie=""){
|
||||||
$this->Url = $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);
|
||||||
if($Cookie != ""){
|
if($Cookie != ""){
|
||||||
$msg .= $this->PutCookie($Cookie);
|
$msg .= $this->PutCookie($Cookie);
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ class HTTP{
|
|||||||
|
|
||||||
function isGetAll($Url = "/", $Cookie=""){
|
function isGetAll($Url = "/", $Cookie=""){
|
||||||
$this->Url = $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);
|
||||||
if($Cookie != ""){
|
if($Cookie != ""){
|
||||||
$msg .= $this->PutCookie($Cookie);
|
$msg .= $this->PutCookie($Cookie);
|
||||||
}
|
}
|
||||||
@@ -99,12 +99,12 @@ class HTTP{
|
|||||||
|
|
||||||
function Post($Url, $Data, $Cookie = ""){
|
function Post($Url, $Data, $Cookie = ""){
|
||||||
$this->Url = $Url;
|
$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 != ""){
|
if($Cookie != ""){
|
||||||
$this->PutCookie($Cookie);
|
$this->PutCookie($Cookie);
|
||||||
}
|
}
|
||||||
$this->PutHead();
|
$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 = "";
|
$out = "";
|
||||||
while (list ($k, $v) = each ($Data)) {
|
while (list ($k, $v) = each ($Data)) {
|
||||||
if(strlen($out) != 0) $out .= "&";
|
if(strlen($out) != 0) $out .= "&";
|
||||||
@@ -118,12 +118,12 @@ class HTTP{
|
|||||||
|
|
||||||
function IsPost($Url, $Data, $Cookie = ""){
|
function IsPost($Url, $Data, $Cookie = ""){
|
||||||
$this->Url = $Url;
|
$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 != ""){
|
if($Cookie != ""){
|
||||||
$this->PutCookie($Cookie);
|
$this->PutCookie($Cookie);
|
||||||
}
|
}
|
||||||
$this->PutHead();
|
$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 = "";
|
$out = "";
|
||||||
while (list ($k, $v) = each ($Data)) {
|
while (list ($k, $v) = each ($Data)) {
|
||||||
if(strlen($out) != 0) $out .= "&";
|
if(strlen($out) != 0) $out .= "&";
|
||||||
@@ -137,15 +137,15 @@ class HTTP{
|
|||||||
|
|
||||||
function PutHead(){
|
function PutHead(){
|
||||||
$msg = "";
|
$msg = "";
|
||||||
$msg .= "Accept: */*\r\n";
|
$msg .= "Accept: */*\n";
|
||||||
$msg .= "Accept-Language: ko\r\n";
|
$msg .= "Accept-Language: ko\n";
|
||||||
$msg .= "Accept-Encoding: gzip, deflate\r\n";
|
$msg .= "Accept-Encoding: gzip, deflate\n";
|
||||||
$msg .= "User-Agent: Mozilla/4.0 (compatible; 62che)\r\n";
|
$msg .= "User-Agent: Mozilla/4.0 (compatible; 62che)\n";
|
||||||
while (list($name, $value) = each ($this->headers)) {
|
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 .= "Host: ".$this->Server.":".$this->Port."\n";
|
||||||
$msg .= "Connection: close\r\n";
|
$msg .= "Connection: close\n";
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ function printFightLog($group) {
|
|||||||
$fp = @fopen("logs/fight{$group}.txt", "r");
|
$fp = @fopen("logs/fight{$group}.txt", "r");
|
||||||
$file = @fread($fp, 3000);
|
$file = @fread($fp, 3000);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\r\n", $file);
|
$log = explode("\n", $file);
|
||||||
$str = "";
|
$str = "";
|
||||||
for($i=0; $i < count($log); $i++) { $str .= ConvertLog($log[$i], 1)."<br>"; }
|
for($i=0; $i < count($log); $i++) { $str .= ConvertLog($log[$i], 1)."<br>"; }
|
||||||
return substr($str, 0, -4);
|
return substr($str, 0, -4);
|
||||||
@@ -179,7 +179,7 @@ function pushFightLog($group, $log) {
|
|||||||
$fp = fopen("logs/fight{$group}.txt", "w");
|
$fp = fopen("logs/fight{$group}.txt", "w");
|
||||||
$size = count($log);
|
$size = count($log);
|
||||||
for($i=0; $i < $size; $i++) {
|
for($i=0; $i < $size; $i++) {
|
||||||
fwrite($fp, $log[$i]."\r\n");
|
fwrite($fp, $log[$i]."\n");
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|||||||
+46
-17
@@ -3,35 +3,64 @@
|
|||||||
|
|
||||||
include "lib.php";
|
include "lib.php";
|
||||||
include "func.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();
|
$connect = dbConn();
|
||||||
increaseRefresh($connect, "서신전달", 1);
|
increaseRefresh($connect, "서신전달", 1);
|
||||||
|
|
||||||
|
//$msg,$genlist 두가지 값을 받
|
||||||
|
|
||||||
if(CheckBlock($connect) == 1 || CheckBlock($connect) == 3) {
|
if(CheckBlock($connect) == 1 || CheckBlock($connect) == 3) {
|
||||||
$msg = "";
|
header('Content-Type: application/json');
|
||||||
$genlist = 0;
|
die(json_encode([
|
||||||
|
'result' => false,
|
||||||
|
'reason' => '차단되었습니다.',
|
||||||
|
'redirect' => NULL
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "select conlimit from game where no=1";
|
$db = newDB();
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$admin = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$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) {
|
if($con >= 2) {
|
||||||
//echo "<script>window.top.main.location.replace('main.php');</script>"; exit();
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode([
|
die(json_encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'reason' => '권한이 충분하지 않습니다.',
|
'reason' => '접속 제한입니다.',
|
||||||
'redirect' => 'main.php',
|
'redirect' => NULL
|
||||||
'page_target' => 'top'
|
]));
|
||||||
]);
|
|
||||||
//echo 'main.php';//TODO:debug all and replace
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg = str_replace("|", "", $msg);
|
$msg = str_replace("|", "", $msg);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ if(!$me2) {
|
|||||||
$date2 = substr($date, 0, 10);
|
$date2 = substr($date, 0, 10);
|
||||||
$fp = fopen("logs/_{$date2}-login.txt", "a");
|
$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," ");
|
$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);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user