diff --git a/hwe/_admin2_submit.php b/hwe/_admin2_submit.php index b80796ba..0e38c1b8 100644 --- a/hwe/_admin2_submit.php +++ b/hwe/_admin2_submit.php @@ -81,7 +81,7 @@ switch($btn) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $log[0] = "●특기 【".getGenSpecial($special2)."】(을)를 익혔습니다!"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special2)."】(을)를 습득"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special2)."】(을)를 습득"); pushGenLog($general, $log); } break; diff --git a/hwe/_admin4.php b/hwe/_admin4.php index 4ec35ea0..02b50962 100644 --- a/hwe/_admin4.php +++ b/hwe/_admin4.php @@ -92,7 +92,6 @@ echo " 최근로그인 IP ID - - "; $genIP .= $gen['ip']."
"; $genID .= $gen['owner']."
"; - $conMsg .= $gen['conmsg']."
"; } $genName .= "
"; $genDate .= "
"; $genIP .= "
"; $genID .= "
"; - $conMsg .= "
"; } echo " $genName $genDate $genIP $genID - $conMsg"; ?> diff --git a/hwe/_admin5.php b/hwe/_admin5.php index d96891a5..c7a76751 100644 --- a/hwe/_admin5.php +++ b/hwe/_admin5.php @@ -250,7 +250,7 @@ for($i=0; $i < $nationCount; $i++) { ?> - +
diff --git a/hwe/_admin7.php b/hwe/_admin7.php index 547e8690..c71f6509 100644 --- a/hwe/_admin7.php +++ b/hwe/_admin7.php @@ -105,10 +105,10 @@ for($i=0; $i < $gencount; $i++) { @@ -117,10 +117,10 @@ for($i=0; $i < $gencount; $i++) {
- + - +
- + - +
diff --git a/hwe/a_traffic.php b/hwe/a_traffic.php index 2c5f54a6..6be1c25f 100644 --- a/hwe/a_traffic.php +++ b/hwe/a_traffic.php @@ -10,15 +10,6 @@ $query = "select year,month,refresh,maxrefresh,maxonline from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $game = MYDB_fetch_array($result); -$fp = @fopen("logs/_traffic.txt", "r"); -@fseek($fp, -1000, SEEK_END); -$file = @fread($fp, 1000); -@fclose($fp); -$log = explode("\n",$file); -$str = ""; -for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i])."
"; } -echo $str; - $curonline = getOnlineNum(); for($i=0; $i < 11; $i++) { $parse = explode("|", $log[count($log)-12+$i]); diff --git a/hwe/b_auction.php b/hwe/b_auction.php index 36234102..a2188dd2 100644 --- a/hwe/b_auction.php +++ b/hwe/b_auction.php @@ -222,7 +222,7 @@ for($i=0; $i < $count; $i++) { @@ -125,10 +125,10 @@ for($i=0; $i < $gencount; $i++) {
최 근 기 록
- +
도 움 말
diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index cab2abfd..65cc4b72 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/b_battleCenter.php @@ -116,7 +116,7 @@ for($i=0; $i < $gencount; $i++) { - +
- + - +
diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index cee07c01..7564483e 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -91,10 +91,10 @@ function go(type) { - + - + @@ -103,10 +103,10 @@ function go(type) { - + - + diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index a3c7cfcb..27c41937 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -159,7 +159,7 @@ if($btn == "추방") { $query = "select year,month from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 추방됨"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 추방됨"); pushGenLog($general, $log); pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); diff --git a/hwe/d_ally.php b/hwe/d_ally.php index 2b443b73..c0294255 100644 --- a/hwe/d_ally.php +++ b/hwe/d_ally.php @@ -75,8 +75,8 @@ if($ok == "수락") { $youlog[] = "{$mynation['name']}(와)과 $when년 불가침에 성공했습니다."; $mylog[] = "{$younation['name']}(와)과 $when년 불가침에 합의했습니다."; - addHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 {$when}년 불가침 성공"); - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 {$when}년 불가침 수락"); + pushGeneralHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 {$when}년 불가침 성공"); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 {$when}년 불가침 수락"); //국메로 저장 $msg = "【외교】{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 {$when}년 불가침 합의, 비고: {$dip2['reserved']}"; diff --git a/hwe/d_cancel.php b/hwe/d_cancel.php index 896dc110..43b260e5 100644 --- a/hwe/d_cancel.php +++ b/hwe/d_cancel.php @@ -61,8 +61,8 @@ if($ok == "수락") { $history[] = "●{$admin['year']}년 {$admin['month']}월:【파기】{$mynation['name']}(이)가 {$younation['name']}(와)과 불가침을 파기 하였습니다."; $youlog[] = "{$mynation['name']}(와)과 파기에 성공했습니다."; $mylog[] = "{$younation['name']}(와)과 파기에 합의했습니다."; - addHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 파기 성공"); - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 파기 수락"); + pushGeneralHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 파기 성공"); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 파기 수락"); //외교 변경 $query = "update diplomacy set state='2',term='0' where me='{$me['nation']}' and you='{$you['nation']}'"; diff --git a/hwe/d_cease.php b/hwe/d_cease.php index 57dcb97e..4bd9a212 100644 --- a/hwe/d_cease.php +++ b/hwe/d_cease.php @@ -61,8 +61,8 @@ if($ok == "수락") { $history[] = "●{$admin['year']}년 {$admin['month']}월:【종전】{$mynation['name']}(이)가 {$younation['name']}(와)과 종전 합의 하였습니다."; $youlog[] = "{$mynation['name']}(와)과 종전에 성공했습니다."; $mylog[] = "{$younation['name']}(와)과 종전에 합의했습니다."; - addHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 종전 성공"); - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 종전 수락"); + pushGeneralHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 종전 성공"); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 종전 수락"); //외교 변경 $query = "update diplomacy set state='2',term='0' where me='{$mynation['nation']}' and you='{$younation['nation']}'"; diff --git a/hwe/d_merge.php b/hwe/d_merge.php index 48819595..8991d36b 100644 --- a/hwe/d_merge.php +++ b/hwe/d_merge.php @@ -100,8 +100,8 @@ if($ok == "수락") { $history[] = "●{$admin['year']}년 {$admin['month']}월:【통합시도】{$mynation['name']}(와)과 {$younation['name']}(이)가 통합을 시도합니다."; $mylog[] = "{$younation['name']}(와)과 통합에 동의했습니다."; $alllog[] = "●{$admin['month']}월:{$me['name']}(이)가 {$younation['name']}(와)과 통합에 동의하였습니다."; - addHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 통합 시도"); - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 통합 시도"); + pushGeneralHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 통합 시도"); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 통합 시도"); //외교 변경 $query = "update diplomacy set state='3',term='24' where me='{$mynation['nation']}' and you='{$younation['nation']}'"; diff --git a/hwe/d_scout.php b/hwe/d_scout.php index c5bf898f..2f203476 100644 --- a/hwe/d_scout.php +++ b/hwe/d_scout.php @@ -33,8 +33,8 @@ if($ok == "수락" && $me['level'] < 12 && $nation['level'] > 0 && $nation['scou $youlog[] = "{$me['name']} 등용에 성공했습니다."; $alllog[] = "●{$admin['month']}월:{$me['name']}(이)가 {$nation['name']}(으)로 망명하였습니다."; $mylog[] = "{$nation['name']}(으)로 망명하여 수도로 이동합니다."; - addHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$me['name']} 등용에 성공"); - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(으)로 망명"); + pushGeneralHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$me['name']} 등용에 성공"); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(으)로 망명"); // 임관내역 추가 $me['nations'] .= "{$nation['nation']},"; diff --git a/hwe/d_surrender.php b/hwe/d_surrender.php index af3c8c86..cbf9f17d 100644 --- a/hwe/d_surrender.php +++ b/hwe/d_surrender.php @@ -90,8 +90,8 @@ if($ok == "수락") { $history[] = "●{$admin['year']}년 {$admin['month']}월:【합병시도】{$mynation['name']}(와)과 {$younation['name']}(이)가 합병을 시도합니다."; $mylog[] = "{$younation['name']}(와)과 합병에 동의했습니다."; $alllog[] = "●{$admin['month']}월:{$me['name']}(이)가 {$younation['name']}(와)과 합병에 동의하였습니다."; - addHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 합병 시도"); - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 합병 시도"); + pushGeneralHistory($you, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 합병 시도"); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 합병 시도"); //외교 변경 $query = "update diplomacy set state='5',term='24' where me='{$mynation['nation']}' and you='{$younation['nation']}'"; diff --git a/hwe/func.php b/hwe/func.php index b655c496..bac417c5 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -56,10 +56,9 @@ function getGeneralID($forceExit=false, $countLogin=true){ //로그인으로 처리 //XXX: 'get' 함수인데 update가 들어가있다. //TODO: 조금더 적절한 형태의 로그인 카운트를 생각해볼 것 - $query=$db->query("update general set logcnt=logcnt+1 ,ip = %s_ip,lastconnect=%s_lastConnect,conmsg=%s_conmsg where owner= %s_userID",[ + $query=$db->query("update general set logcnt=logcnt+1 ,ip = %s_ip,lastconnect=%s_lastConnect where owner= %s_userID",[ 'ip' => getenv("REMOTE_ADDR"), 'lastConnect' => date('Y-m-d H:i:s'), - 'conmsg' => Util::array_get($_SESSION['conmsg'], ''), 'userID' => $userID ]); $_SESSION[$idKey] = $generalID; @@ -1136,113 +1135,6 @@ function generalInfo2($connect, $no) { "; } -function getRawLog($path, $count, $line_length){ - //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) { - if(!file_exists("logs/_tricklog.txt")){ - return ''; - } - $fp = @fopen("logs/_tricklog.txt", "r"); - @fseek($fp, -$count*150, SEEK_END); - $file = @fread($fp, $count*150); - @fclose($fp); - $log = explode("\n",$file); - $str = ""; - for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i])."
"; } - echo $str; -} - -function AuctionLog($count) { - if(!file_exists("logs/_auctionlog.txt")){ - return ''; - } - $fp = @fopen("logs/_auctionlog.txt", "r"); - @fseek($fp, -$count*300, SEEK_END); - $file = @fread($fp, $count*300); - @fclose($fp); - $log = explode("\n",$file); - $str = ""; - for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i])."
"; } - echo $str; -} - -function MyLog($no, $count) { - if(!file_exists("logs/gen{$no}.txt")){ - return ''; - } - $fp = @fopen("logs/gen{$no}.txt", "r"); - @fseek($fp, -$count*300, SEEK_END); - $file = @fread($fp, $count*300); - @fclose($fp); - $log = explode("\n",$file); - $str = ""; - for($i=0; $i < $count; $i++) { - $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."
" : "
"; - } - echo $str; -} - -function MyBatRes($no, $count) { - if(!file_exists("logs/batres{$no}.txt")){ - return ''; - } - $fp = @fopen("logs/batres{$no}.txt", "r"); - @fseek($fp, -$count*300, SEEK_END); - $file = @fread($fp, $count*300); - @fclose($fp); - $log = explode("\n",$file); - $str = ""; - for($i=0; $i < $count; $i++) { - $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."
" : "
"; - } - echo $str; -} - -function MyBatLog($no, $count) { - if(!file_exists("logs/batlog{$no}.txt")){ - return ''; - } - $fp = @fopen("logs/batlog{$no}.txt", "r"); - @fseek($fp, -$count*300, SEEK_END); - $file = @fread($fp, $count*300); - @fclose($fp); - $log = explode("\n",$file); - $str = ""; - for($i=0; $i < $count; $i++) { - $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."
" : "
"; - } - echo $str; -} - -function MyHistory($connect, $no) { - $query = "select history from general where no='$no'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $general = MYDB_fetch_array($result); - echo ConvertLog($general['history']); -} - -function addHistory($me, $history) { - DB::db()->query("update general set history=concat(%s, history) where no=%i", - $history.'
', $me['no']); -} - -function addNationHistory($nation, $history) { - //FIXME: update 쿼리만으로도 구성 가능해보임. - $nation['history'] = "{$nation['history']}{$history}
"; - DB::db()->query("update nation set history=concat(%s, history) where nation=%i", - $history.'
', $nation['nation']); -} - function adminMsg($connect) { $query = "select msg from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -1445,10 +1337,19 @@ function increaseRefresh($type="", $cnt=1) { $date = date('Y_m_d H:i:s'); $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->generalName,13," ").StringUtil::Fill2($session->ip,16," ").StringUtil::Fill2($type, 10, " ")." 동접자: {$online}"; - fwrite($fp, $msg."\n"); - fclose($fp); + file_put_contents( + "logs/_{$date2}_refresh.txt", + sprintf( + "%s, %s, %s, %s, %d\n", + $date, + $session->userName, + $session->generalName, + $session->ip, + $type, + $online + ), + FILE_APPEND + ); $proxy_headers = array( 'HTTP_VIA', @@ -1473,9 +1374,17 @@ function increaseRefresh($type="", $cnt=1) { if(isset($_SERVER[$x])) $str .= "//{$x}:{$_SERVER[$x]}"; } if($str != "") { - file_put_contents("logs/_{$date2}_ipcheck.txt", - sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s\n", - $_SESSION['userName'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND); + $session = Session::Instance(); + file_put_contents( + "logs/_{$date2}_ipcheck.txt", + sprintf( + "%s, %s, %s%s\n", + $session->userName, + $session->generalName, + $_SERVER['REMOTE_ADDR'], + $str + ), + FILE_APPEND); } } @@ -1550,7 +1459,12 @@ function tryLock() { function unlock() { // 풀림 //NOTE: unlock에는 table lock이 필요없는가? - DB::db()->query("update plock set plock=0"); + $db = DB::db(); + $db->query("lock tables plock write"); + $db->update('plock', [ + 'plock'=>0 + ], true); + $db->query("unlock tables"); } function timeover() { @@ -1897,7 +1811,7 @@ function addAge($connect) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $log[0] = "●특기 【".getGenSpecial($special)."】(을)를 익혔습니다!"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special)."】(을)를 습득"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special)."】(을)를 습득"); pushGenLog($general, $log); } @@ -1913,7 +1827,7 @@ function addAge($connect) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $log[0] = "●특기 【".getGenSpecial($special2)."】(을)를 익혔습니다!"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special2)."】(을)를 습득"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special2)."】(을)를 습득"); pushGenLog($general, $log); } } @@ -2188,7 +2102,7 @@ function updateTurntime($connect, $no) { $log[0] = "●나이가 들어 은퇴하고 자손에게 자리를 물려줍니다."; pushGenLog($general, $log); - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:나이가 들어 은퇴하고, 자손에게 관직을 물려줌"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:나이가 들어 은퇴하고, 자손에게 관직을 물려줌"); } $turntime = addTurn($general['turntime'], $admin['turnterm']); @@ -2337,7 +2251,7 @@ function uniqueItem($connect, $general, $log, $vote=0) { case 0: $log[] = "".getWeapName($it)."(을)를 습득했습니다!"; $alllog[0] = "●{$game['month']}월:{$general['name']}(이)가 ".getWeapName($it)."(을)를 습득했습니다!"; - addHistory($general, "●{$game['year']}년 {$game['month']}월:".getWeapName($it)."(을)를 습득"); + pushGeneralHistory($general, "●{$game['year']}년 {$game['month']}월:".getWeapName($it)."(을)를 습득"); if($vote == 0) { $history[0] = "●{$game['year']}년 {$game['month']}월:【아이템】{$nation['name']}{$general['name']}(이)가 ".getWeapName($it)."(을)를 습득했습니다!"; } elseif($vote == 1) { @@ -2351,7 +2265,7 @@ function uniqueItem($connect, $general, $log, $vote=0) { case 1: $log[] = "".getBookName($it)."(을)를 습득했습니다!"; $alllog[0] = "●{$game['month']}월:{$general['name']}(이)가 ".getBookName($it)."(을)를 습득했습니다!"; - addHistory($general, "●{$game['year']}년 {$game['month']}월:".getBookName($it)."(을)를 습득"); + pushGeneralHistory($general, "●{$game['year']}년 {$game['month']}월:".getBookName($it)."(을)를 습득"); if($vote == 0) { $history[0] = "●{$game['year']}년 {$game['month']}월:【아이템】{$nation['name']}{$general['name']}(이)가 ".getBookName($it)."(을)를 습득했습니다!"; } elseif($vote == 1) { @@ -2365,7 +2279,7 @@ function uniqueItem($connect, $general, $log, $vote=0) { case 2: $log[] = "".getHorseName($it)."(을)를 습득했습니다!"; $alllog[0] = "●{$game['month']}월:{$general['name']}(이)가 ".getHorseName($it)."(을)를 습득했습니다!"; - addHistory($general, "●{$game['year']}년 {$game['month']}월:".getHorseName($it)."(을)를 습득"); + pushGeneralHistory($general, "●{$game['year']}년 {$game['month']}월:".getHorseName($it)."(을)를 습득"); if($vote == 0) { $history[0] = "●{$game['year']}년 {$game['month']}월:【아이템】{$nation['name']}{$general['name']}(이)가 ".getHorseName($it)."(을)를 습득했습니다!"; } elseif($vote == 1) { @@ -2379,7 +2293,7 @@ function uniqueItem($connect, $general, $log, $vote=0) { case 3: $log[] = "".getItemName($it)."(을)를 습득했습니다!"; $alllog[0] = "●{$game['month']}월:{$general['name']}(이)가 ".getItemName($it)."(을)를 습득했습니다!"; - addHistory($general, "●{$game['year']}년 {$game['month']}월:".getItemName($it)."(을)를 습득"); + pushGeneralHistory($general, "●{$game['year']}년 {$game['month']}월:".getItemName($it)."(을)를 습득"); if($vote == 0) { $history[0] = "●{$game['year']}년 {$game['month']}월:【아이템】{$nation['name']}{$general['name']}(이)가 ".getItemName($it)."(을)를 습득했습니다!"; } elseif($vote == 1) { @@ -2612,7 +2526,7 @@ function nextRuler($connect, $general) { $history[] = "●{$admin['year']}년 {$admin['month']}월:【유지】{$nextruler['name']}(이)가 {$nation['name']}의 유지를 이어 받았습니다"; pushWorldHistory($history, $admin['year'], $admin['month']); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:【유지】{$nextruler['name']}(이)가 {$nation['name']}의 유지를 이어 받음."); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:【유지】{$nextruler['name']}(이)가 {$nation['name']}의 유지를 이어 받음."); // 장수 삭제 및 부대처리는 checkTurn에서 } diff --git a/hwe/func_diplomacy.php b/hwe/func_diplomacy.php index c0021ac4..50c454e7 100644 --- a/hwe/func_diplomacy.php +++ b/hwe/func_diplomacy.php @@ -58,8 +58,8 @@ function acceptScout($messageInfo, $general, $msgResponse){ $youlog[] = "{$myName} 등용에 성공했습니다."; $alllog[] = "●{$month}월:{$myName}(이)가 {$nationName}(으)로 망명하였습니다."; $mylog[] = "{$nationName}(으)로 망명하여 수도로 이동합니다."; - addHistory($you, "●{$year}년 {$month}월:{$myName} 등용에 성공"); - addHistory($me, "●{$year}년 {$month}월:{$nationName}(으)로 망명"); + pushGeneralHistory($you, "●{$year}년 {$month}월:{$myName} 등용에 성공"); + pushGeneralHistory($me, "●{$year}년 {$month}월:{$nationName}(으)로 망명"); $me['nations'] .= "{$nationID},"; diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index e0e03476..01cdf939 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -722,7 +722,7 @@ function checkMerge($connect) { for($i=0; $i < $gencount; $i++) { $gen = MYDB_fetch_array($result); pushGenLog($gen, $genlog); - addHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$you['makenation']}로 통합에 성공"); + pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$you['makenation']}로 통합에 성공"); } //항복국 장수들 역사 기록 및 로그 전달 $query = "select no,name,nation from general where nation='{$me['nation']}'"; @@ -732,12 +732,12 @@ function checkMerge($connect) { for($i=0; $i < $gencount2; $i++) { $gen = MYDB_fetch_array($result); pushGenLog($gen, $genlog); - addHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}{$you['makenation']}로 통합에 성공"); + pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}{$you['makenation']}로 통합에 성공"); } $history[] = "●{$admin['year']}년 {$admin['month']}월:【통합】{$mynation['name']}(와)과 {$younation['name']}(이)가 {$you['makenation']}(으)로 통합하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【혼란】통합에 반대하는 세력들로 인해 {$you['makenation']}에 혼란이 일고 있습니다."; - addNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$you['makenation']}로 통합"); + pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$you['makenation']}로 통합"); $newGenCount = $gencount + $gencount2; if($newGenCount < 10) { $newGenCount = 10; } @@ -835,7 +835,7 @@ function checkSurrender($connect) { for($i=0; $i < $gencount; $i++) { $gen = MYDB_fetch_array($result); pushGenLog($gen, $genlog); - addHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']} 합병에 성공"); + pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']} 합병에 성공"); } //항복국 장수들 역사 기록 및 로그 전달 $query = "select no,name,nation from general where nation='{$me['nation']}'"; @@ -845,12 +845,12 @@ function checkSurrender($connect) { for($i=0; $i < $gencount2; $i++) { $gen = MYDB_fetch_array($result); pushGenLog($gen, $genlog); - addHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$younation['name']}(으)로 항복"); + pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$younation['name']}(으)로 항복"); } $history[] = "●{$admin['year']}년 {$admin['month']}월:【투항】{$mynation['name']} (이)가 {$younation['name']}(으)로 항복하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【혼란】통합에 반대하는 세력들로 인해 {$younation['name']}에 혼란이 일고 있습니다."; - addNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 합병"); + pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 합병"); $newGenCount = $gencount + $gencount2; if($newGenCount < 10) { $newGenCount = 10; } @@ -955,21 +955,21 @@ function updateNationState($connect) { switch($nationlevel) { case 7: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."(을)를 자칭하였습니다."; - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."(을)를 자칭"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."(을)를 자칭"); break; case 6: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 등극하였습니다."; - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 등극"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 등극"); break; case 5: case 4: case 3: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 임명되었습니다."; - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 임명됨"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 임명됨"); break; case 2: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 독립하여 ".getNationLevel($nationlevel)."로 나섰습니다."; - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."로 나서다"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."로 나서다"); break; } @@ -1140,7 +1140,7 @@ function checkEmperior($connect) { $allcount = MYDB_num_rows($result); if($count == $allcount) { - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(이)가 전토를 통일"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(이)가 전토를 통일"); $query = "update game set isUnited=2,conlimit=conlimit*100"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/func_history.php b/hwe/func_history.php index 9609bb76..119f5772 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -1,111 +1,134 @@ 0) { - $fp = fopen("logs/_tricklog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushProcessLog($log) { - $size = count($log); - if($size > 0) { - $date = date('Y_m_d'); - $fp = fopen("logs/_{$date}_processlog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} +//File-based function delStepLog() { $date = date('Y_m_d'); @unlink("logs/_{$date}_steplog.txt"); } +function pushRawFileLog($path, $lines){ + if(!$lines){ + return; + } + if(is_string($lines)){ + $lines = [$lines]; + } + $text = join("\n", $lines)."\n"; + file_put_contents($path, $text, FILE_APPEND); +} + +function getRawFileLogRecent(string $path, int $count, $expectedLineLength=null){ + $tail = new FileTail($path); + return $tail->smart($count, $expectedLineLength, true); +} + +function getRawFileLogAll(string $path){ + if(!file_exists($path)){ + return []; + } + return explode("\n", file_get_contents($path)); +} + +function getFormattedFileLogRecent(string $path, int $count, $expectedLineLength=null){ + return array_map(function($text){ + return ConvertLog($text); + }, getRawFileLogRecent($path, $count, $expectedLineLength)); +} + +function getFormattedFileLogAll(string $path){ + return array_map(function($text){ + return ConvertLog($text); + }, getRawFileLogAll($path)); +} + +function pushTnmtFightLog(int $group, $log) { + pushRawFileLog("logs/fight{$group}.txt", $log); +} + +function getTnmtFightLogAll(int $group) { + return join('
',getFormattedFileLogAll("logs/fight{$group}.txt")); +} + +function pushTrickLog($log) { + pushRawFileLog("logs/_tricklog.txt", $log); +} + +function getTrickLogRecent($count) { + return join('
', getFormattedFileLogRecent("logs/_tricklog.txt", $count, 150)); +} + +function pushProcessLog($log) { + $date = date('Y_m_d'); + pushRawFileLog("logs/_{$date}_processlog.txt", $log); +} + + function pushStepLog($log) { $date = date('Y_m_d'); - $fp = fopen("logs/_{$date}_steplog.txt", "a"); - fwrite($fp, $log."\n"); - fclose($fp); + pushRawFileLog("logs/_{$date}_steplog.txt", $log); } function pushLockLog($log) { - $size = count($log); - if($size > 0) { - $date = date('Y_m_d'); - $fp = fopen("logs/_{$date}_locklog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } + $date = date('Y_m_d'); + pushRawFileLog("logs/_{$date}_locklog.txt", $log); } function pushAdminLog($log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/_adminlog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } + pushRawFileLog("logs/_adminlog.txt", $log); } function pushAuctionLog($log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/_auctionlog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } + pushRawFileLog("logs/_auctionlog.txt", $log); +} + +function getAuctionLogRecent(int $count) { + return join('
', getFormattedFileLogRecent("logs/_auctionlog.txt", $count, 300)); } function pushGenLog($general, $log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/gen{$general['no']}.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } + $no = Util::toInt($general['no']); + pushRawFileLog("logs/gen{$no}.txt", $log); +} + +function getGenLogRecent(int $no, int $count) { + return join('
', getFormattedFileLogRecent("logs/gen{$no}.txt", $count, 300)); } function pushBatRes($general, $log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/batres{$general['no']}.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } + $no = Util::toInt($general['no']); + pushRawFileLog("logs/batres{$no}.txt", $log); +} + +function getBatResRecent(int $no, int $count) { + return join('
', getFormattedFileLogRecent("logs/batres{$no}.txt", $count, 300)); } function pushBatLog($general, $log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/batlog{$general['no']}.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } + $no = Util::toInt($general['no']); + pushRawFileLog("logs/batlog{$no}.txt", $log); } +function getBatLogRecent(int $no, int $count) { + return join('
', getFormattedFileLogRecent("logs/batlog{$no}.txt", $count, 300)); +} +//DB-based +function pushNationHistory($nation, $history) { + DB::db()->query("UPDATE nation set history=concat(%s, history) where nation=%i", + $history.'
', $nation['nation']); +} + +function pushGeneralHistory($me, $history) { + DB::db()->query("UPDATE general set history=concat(%s, history) where no=%i", + $history.'
', $me['no']); +} + +function getGeneralHistoryAll(int $no) { + $history = DB::db()->queryFirstField('SELECT history FROM general WHERE `no`=%i',$no); + return ConvertLog($history); +} function pushWorldHistory(array $history, $year=null, $month=null) { $db = DB::db(); @@ -169,7 +192,12 @@ function getGeneralPublicRecordRecent($count) { $db = DB::db(); $texts = []; - foreach($db->queryFirstColumn('SELECT `text` from general_public_record order by id desc limit %i', $count) as $text){ + foreach( + $db->queryFirstColumn( + 'SELECT `text` from general_public_record order by id desc limit %i', + $count + ) as $text + ){ $texts[] = ConvertLog($text); } return join('
', $texts); diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index a671bdd2..f0b7c36a 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -412,9 +412,9 @@ function process_52($connect, &$general) { $genlog[0] = "{$younation['name']}(으)로 금$gold 쌀$rice을 지원했습니다."; pushGenLog($gen, $genlog); } - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(으)로 금$gold 쌀$rice을 지원"); - addNationHistory($mynation, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(으)로 금$gold 쌀$rice을 지원"); - addNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(으)로부터 금$gold 쌀$rice을 지원 받음"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(으)로 금$gold 쌀$rice을 지원"); + pushNationHistory($mynation, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}(으)로 금$gold 쌀$rice을 지원"); + pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(으)로부터 금$gold 쌀$rice을 지원 받음"); //상대국 수뇌부에게 로그 전달 $query = "select no,name,nation from general where nation='$which' and level>='9'"; @@ -660,9 +660,9 @@ function process_62($connect, &$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$younation['name']}선전 포고 하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【선포】{$nation['name']}(이)가 {$younation['name']}에 선전 포고 하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}에 선전 포고"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$younation['name']}에 선전 포고"); - addNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 선전 포고"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}에 선전 포고"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$younation['name']}에 선전 포고"); + pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 선전 포고"); //외교 변경 $query = "update diplomacy set state='1',term='24' where me='{$nation['nation']}' and you='{$younation['nation']}'"; @@ -874,8 +874,8 @@ function process_65($connect, &$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}초토화를 명령하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【초토화】{$nation['name']}(이)가 {$destcity['name']}(을)를 초토화하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}초토화를 명령"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}초토화를 명령"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}초토화를 명령"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}초토화를 명령"); //외교제한 24 $amount = round($destcity['pop'] * 0.1); @@ -971,8 +971,8 @@ function process_66($connect, &$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(으)로 천도를 명령하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【천도】{$nation['name']}(이)가 {$destcity['name']}(으)로 천도하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}(으)로 천도 명령"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(으)로 천도 명령"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}(으)로 천도 명령"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(으)로 천도 명령"); //수도 변경 $query = "update nation set l{$general['level']}term='0',capital='{$destcity['city']}',capset='1',gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'"; @@ -1056,8 +1056,8 @@ function process_67($connect, &$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(을)를 증축하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【증축】{$nation['name']}(이)가 {$destcity['name']}(을)를 증축하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}(을)를 증축"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(을)를 증축"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}(을)를 증축"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(을)를 증축"); //물자 감소 $query = "update nation set l{$general['level']}term='0',capset='1',gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'"; @@ -1143,8 +1143,8 @@ function process_68($connect, &$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(을)를 감축하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【감축】{$nation['name']}(이)가 {$destcity['name']}(을)를 감축하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}(을)를 감축"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(을)를 감축"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}(을)를 감축"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}(을)를 감축"); //물자 증가 $query = "update nation set l{$general['level']}term='0',capset='1',gold=gold+'$amount',rice=rice+'$amount' where nation='{$general['nation']}'"; @@ -1251,8 +1251,8 @@ function process_71($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 필사즉생(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 필사즉생(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 필사즉생(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:필사즉생(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 필사즉생(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:필사즉생(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 필사즉생(을)를 발동"); //전장수 훈사100 $query = "update general set atmos=100,train=100 where nation='{$general['nation']}'"; @@ -1361,8 +1361,8 @@ function process_72($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}백성동원(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destcity['name']}백성동원(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destcity['name']}백성동원(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}백성동원(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}백성동원(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}백성동원(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}백성동원(을)를 발동"); //도시 성수 80% $query = "update city set def=def2*0.8,wall=wall2*0.8 where city='{$destcity['city']}'"; @@ -1486,9 +1486,9 @@ function process_73($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}수몰(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destcity['name']}수몰(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destcity['name']}수몰(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}수몰(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}{$destcity['name']}수몰(을)를 발동"); - addNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국의 {$destcity['name']}수몰(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}수몰(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}{$destcity['name']}수몰(을)를 발동"); + pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국의 {$destcity['name']}수몰(을)를 발동"); //도시 성수 80% 감소 $query = "update city set def=def*0.2,wall=wall*0.2 where city='{$destcity['city']}'"; @@ -1603,9 +1603,9 @@ function process_74($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destcity['name']}허보(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destcity['name']}허보(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destcity['name']}허보(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}허보(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}{$destcity['name']}허보(을)를 발동"); - addNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국의 {$destcity['name']}허보(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}허보(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}{$destcity['name']}허보(을)를 발동"); + pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국의 {$destcity['name']}허보(을)를 발동"); //상대국 도시 전부 검색 $query = "select city from city where nation='{$destcity['nation']}' and supply=1"; @@ -1744,9 +1744,9 @@ function process_75($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}피장파장(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destnation['name']}피장파장(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destnation['name']}피장파장(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}피장파장(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}피장파장(을)를 발동"); - addNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 피장파장(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}피장파장(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}피장파장(을)를 발동"); + pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 피장파장(을)를 발동"); //전략기한+60 $query = "update nation set tricklimit=tricklimit+60 where nation='{$destnation['nation']}'"; @@ -1843,8 +1843,8 @@ function process_76($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 의병모집(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 의병모집(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 의병모집(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:의병모집(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 의병모집(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:의병모집(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 의병모집(을)를 발동"); $query = "select avg(gennum) as gennum from nation"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -2077,9 +2077,9 @@ function process_77($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}이호경식(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destnation['name']}이호경식(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destnation['name']}이호경식(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}이호경식(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}이호경식(을)를 발동"); - addNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 이호경식(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}이호경식(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}이호경식(을)를 발동"); + pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 이호경식(을)를 발동"); //선포+3개월 if($dip['state'] == 0) { @@ -2202,9 +2202,9 @@ function process_78($connect, &$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}급습(을)를 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destnation['name']}급습(을)를 발동하였습니다."; $tricklog[count($tricklog)] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}(이)가 {$destnation['name']}급습(을)를 발동하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}급습(을)를 발동"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}급습(을)를 발동"); - addNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 급습(을)를 발동"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}급습(을)를 발동"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$destnation['name']}급습(을)를 발동"); + pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}(이)가 아국에 급습(을)를 발동"); //선포-3개월 $query = "update diplomacy set term=term-3 where (me='{$general['nation']}' and you='{$destnation['nation']}') or (you='{$general['nation']}' and me='{$destnation['nation']}')"; @@ -2278,8 +2278,8 @@ function process_81($connect, &$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 국기를 변경하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【국기변경】{$nation['name']}(이)가 국기를 변경하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:국기를 변경"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 국기를 변경"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:국기를 변경"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 국기를 변경"); //국기변경 $query = "update nation set color='$color',can_change_flag=can_change_flag-1 where nation='{$nation['nation']}'"; diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index 3a134c5c..2d239092 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -126,7 +126,7 @@ function process_25($connect, &$general) { } else { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$nation['name']}임관했습니다."; $log[] = "●{$admin['month']}월:{$nation['name']}에 임관했습니다. <1>$date"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에 임관"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에 임관"); if($gencount < 10) { $exp = 700; } else { $exp = 100; } @@ -254,7 +254,7 @@ function process_29($connect, &$general) { $log[] = "●{$admin['month']}월:$name(이)라는 인재를 {$scoutType}하였습니다! <1>$date"; $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 $name(이)라는 인재를 {$scoutType}하였습니다!"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:$name(이)라는 인재를 {$scoutType}"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:$name(이)라는 인재를 {$scoutType}"); $query = "select max(leader+power+intel) as lpi, avg(dedication) as ded,avg(experience) as exp, avg(dex0) as dex0, avg(dex10) as dex10, avg(dex20) as dex20, avg(dex30) as dex30, avg(dex40) as dex40 from general where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -475,7 +475,7 @@ function process_45($connect, &$general) { if($dipcount1 > 0) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 통합에 반대하며 {$nation['name']}(을)를 떠났습니다."; $log[] = "●{$admin['month']}월:통합에 반대하며 {$nation['name']}에서 떠났습니다. <1>$date"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:통합에 반대하며 {$nation['name']}(을)를 떠남"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:통합에 반대하며 {$nation['name']}(을)를 떠남"); // 국적 바꾸고 등급 재야로 $query = "update general set resturn='SUCCESS',belong=0,nation=0,level=0,makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}' where no='{$general['no']}'"; @@ -483,7 +483,7 @@ function process_45($connect, &$general) { } elseif($dipcount2 > 0) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 합병에 반대하며 {$nation['name']}(을)를 떠났습니다."; $log[] = "●{$admin['month']}월:합병에 반대하며 {$nation['name']}에서 떠났습니다. <1>$date"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:합병에 반대하며 {$nation['name']}(을)를 떠남"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:합병에 반대하며 {$nation['name']}(을)를 떠남"); // 국적 바꾸고 등급 재야로 $query = "update general set resturn='SUCCESS',belong=0,nation=0,level=0,makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}' where no='{$general['no']}'"; @@ -491,7 +491,7 @@ function process_45($connect, &$general) { } else { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$nation['name']}에서 하야했습니다."; $log[] = "●{$admin['month']}월:{$nation['name']}에서 하야했습니다. <1>$date"; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 하야"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 하야"); // 국적 바꾸고 등급 재야로 // 명성/공헌 N*10% 감소 $query = "update general set resturn='SUCCESS',belong=0,betray=betray+1,nation=0,level=0,experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}' where no='{$general['no']}'"; @@ -599,8 +599,8 @@ function process_46($connect, &$general) { $log[] = "●{$admin['month']}월:{$nation['name']}(을)를 건국하였습니다. <1>$date"; $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$city['name']}에 국가를 건설하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【건국】".getNationType($type)." {$nation['name']}(이)가 새로이 등장하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(을)를 건국"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$nation['name']}(을)를 건국"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(을)를 건국"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$nation['name']}(을)를 건국"); $exp = 1000; $ded = 1000; @@ -651,7 +651,7 @@ function process_47($connect, &$general) { } else { $log[] = "●{$admin['month']}월:영토를 버리고 방랑의 길을 떠납니다. <1>$date"; $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 방랑의 길을 떠납니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(을)를 버리고 방랑"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(을)를 버리고 방랑"); $history[] = "●{$admin['year']}년 {$admin['month']}월:【방랑】{$general['name']}은(는) 방랑의 길을 떠납니다."; @@ -736,9 +736,9 @@ function process_54($connect, &$general) { $log[] = "●{$admin['month']}월:{$nextruler['name']}에게 군주의 자리를 물려줍니다. <1>$date"; $youlog[] = "●{$admin['month']}월:{$general['name']}에게서 군주의 자리를 물려받습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주자리를 {$nextruler['name']}에게 선양"); - addHistory($nextruler, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주자리를 물려 받음"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$nextruler['name']}에게 선양"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주자리를 {$nextruler['name']}에게 선양"); + pushGeneralHistory($nextruler, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주자리를 물려 받음"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$nextruler['name']}에게 선양"); } pushGenLog($general, $log); pushGenLog($nextruler, $youlog); @@ -808,8 +808,8 @@ function process_55($connect, &$general) { $log[] = "●{$admin['month']}월:거병에 성공하였습니다. <1>$date"; $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$city['name']}에서 거병하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【거병】{$general['name']}(이)가 세력을 결성하였습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$city['name']}에서 거병"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$city['name']}에서 거병"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$city['name']}에서 거병"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$city['name']}에서 거병"); // 외교테이블 추가 @@ -853,7 +853,7 @@ function process_56($connect, &$general) { } else { $log[] = "●{$admin['month']}월:세력을 해산했습니다. <1>$date"; $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 세력을 해산했습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(을)를 해산"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}(을)를 해산"); $query = "select no from general where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -935,9 +935,9 @@ function process_57($connect, &$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 모반에 성공했습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【모반】{$general['name']}(이)가 {$nation['name']}의 군주 자리를 찬탈했습니다."; - addHistory($general, "●{$admin['year']}년 {$admin['month']}월:모반으로 {$nation['name']}의 군주자리를 찬탈"); - addHistory($ruler, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}의 모반으로 인해 {$nation['name']}의 군주자리를 박탈당함"); - addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$ruler['name']}에게서 군주자리를 찬탈"); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:모반으로 {$nation['name']}의 군주자리를 찬탈"); + pushGeneralHistory($ruler, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}의 모반으로 인해 {$nation['name']}의 군주자리를 박탈당함"); + pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}(이)가 {$ruler['name']}에게서 군주자리를 찬탈"); } pushGenLog($general, $log); pushGenLog($ruler, $youlog); diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index 3ba52ae9..31857c84 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -167,25 +167,6 @@ function printRow($k, $npc, $name, $abil, $game, $win, $draw, $lose, $gd, $gl, $ echo "$k$name$abil$game$win$draw$lose$gd$gl"; } -function printFightLog($group) { - $fp = @fopen("logs/fight{$group}.txt", "r"); - $file = @fread($fp, 3000); - @fclose($fp); - $log = explode("\n", $file); - $str = ""; - for($i=0; $i < count($log); $i++) { $str .= ConvertLog($log[$i], 1)."
"; } - return substr($str, 0, -4); -} - -function pushFightLog($group, $log) { - $fp = fopen("logs/fight{$group}.txt", "w"); - $size = count($log); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); -} - function printFighting($tournament, $phase) { $code = $tournament * 100 + $phase; if($code == 0) { @@ -193,7 +174,7 @@ function printFighting($tournament, $phase) { echo " "; echo " "; echo " "; - echo "".printFightLog(50).""; + echo "".getTnmtFightLogAll(50).""; echo " "; echo " "; echo " "; @@ -202,28 +183,28 @@ function printFighting($tournament, $phase) { } elseif($code <= 300) { echo ""; for($i=0; $i < 8; $i++) { - echo "".printFightLog($i).""; + echo "".getTnmtFightLogAll($i).""; } echo ""; } elseif($code < 400) { } elseif($code <= 500) { echo ""; for($i=10; $i < 18; $i++) { - echo "".printFightLog($i).""; + echo "".getTnmtFightLogAll($i).""; } echo ""; } elseif($code < 700) { } elseif($code <= 800) { echo ""; for($i=20; $i < 28; $i++) { - echo "".printFightLog($i).""; + echo "".getTnmtFightLogAll($i).""; } echo ""; } elseif($code <= 900) { echo ""; for($i=30; $i < 34; $i++) { echo " "; - echo "".printFightLog($i).""; + echo "".getTnmtFightLogAll($i).""; } echo ""; } elseif($code <= 1000) { @@ -231,7 +212,7 @@ function printFighting($tournament, $phase) { for($i=40; $i < 42; $i++) { echo " "; echo " "; - echo "".printFightLog($i).""; + echo "".getTnmtFightLogAll($i).""; echo " "; } echo ""; @@ -239,13 +220,11 @@ function printFighting($tournament, $phase) { } function startTournament($connect, $auto, $type) { - for($i=0; $i < 8; $i++) { - @unlink("logs/fight{$i}.txt"); - @unlink("logs/fight1{$i}.txt"); - @unlink("logs/fight2{$i}.txt"); - @unlink("logs/fight3{$i}.txt"); - @unlink("logs/fight4{$i}.txt"); - @unlink("logs/fight5{$i}.txt"); + for($i=0; $i<50; $i++){ + $filepath = "logs/fight{$i}.txt"; + if(file_exists($filepath)){ + @unlink($filepath); + } } switch($auto) { @@ -639,8 +618,8 @@ function setGift($connect, $tnmt_type, $tnmt, $phase) { $query = "select no from general where no={$general2['no']}"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen2 = MYDB_fetch_array($result); - addHistory($gen1, "●{$admin['year']}년 {$admin['month']}월:{$tp} 대회에서 우승"); - addHistory($gen2, "●{$admin['year']}년 {$admin['month']}월:{$tp} 대회에서 준우승"); + pushGeneralHistory($gen1, "●{$admin['year']}년 {$admin['month']}월:{$tp} 대회에서 우승"); + pushGeneralHistory($gen2, "●{$admin['year']}년 {$admin['month']}월:{$tp} 대회에서 준우승"); $cost = $admin['develcost'] * 20; $cost2 = $admin['develcost'] * 12; @@ -989,5 +968,5 @@ function fight($connect, $tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) { $log[] = "--------------- 다음경기 ---------------
{$gen1['name']} vs {$gen2['name']}"; } - pushFightLog($group, $log); + pushTnmtFightLog($group, $log); } diff --git a/hwe/index.php b/hwe/index.php index ee325bb2..60aff31d 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -238,7 +238,7 @@ if(Session::getUserGrade() >= 5) { - + 중원 정세 diff --git a/hwe/join_post.php b/hwe/join_post.php index 0f23e62d..d115b535 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -239,7 +239,7 @@ if($id_num) { } else { $log[0] = "●{$admin['month']}월:{$cityname['name']}에서 {$me['name']}(이)라는 호걸이 천하에 이름을 알립니다."; } - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$me['name']}, {$cityname['name']}에서 큰 뜻을 품다."); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$me['name']}, {$cityname['name']}에서 큰 뜻을 품다."); $mylog[] = "●삼국지 모의전투 PHP의 세계에 오신 것을 환영합니다 ^o^"; $mylog[] = "●처음 하시는 경우에는 도움말을 참고하시고,"; $mylog[] = "●문의사항이 있으시면 게시판에 글을 남겨주시면 되겠네요~"; @@ -248,7 +248,7 @@ if($id_num) { $mylog[] = "●연령은 $age세로 시작합니다."; if($genius == 1) { $mylog[] = "●축하합니다! 천재로 태어나 처음부터 ".getGenSpecial($special2)." 특기를 가지게 됩니다!"; - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:".getGenSpecial($special2)." 특기를 가진 천재로 탄생."); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:".getGenSpecial($special2)." 특기를 가진 천재로 탄생."); } pushGenLog($me, $mylog); pushGeneralPublicRecord($log, $admin['year'], $admin['month']); diff --git a/hwe/login_process.php b/hwe/login_process.php deleted file mode 100644 index fc400605..00000000 --- a/hwe/login_process.php +++ /dev/null @@ -1,59 +0,0 @@ -queryFirstRow('select no,name,nation,block,killturn from general where owner= %s', $userID); -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - - -if(!$me) { - MessageBox("캐릭터가 없습니다!!!"); - //TODO:login_process를 rest 형태로 처리 - //header ("Location: index.php"); - exit(0); -} - - -switch($me['block']) { -case 1: - MessageBox("비매너 발언으로 인해, 발언권이 제한됩니다."); break; -case 2: - MessageBox("현재 블럭된 계정입니다. 턴 실행이 제한됩니다."); - MessageBox("절대 1계정만 사용하십시오! {$me['killturn']}시간 후 재등록 가능합니다."); break; -case 3: - MessageBox("현재 블럭된 계정입니다. 발언권과 턴 실행이 제한됩니다."); - MessageBox("절대 1계정만 사용하십시오! {$me['killturn']}시간 후 재등록 가능합니다."); break; -} - -$_SESSION[DB::prefix().'p_no'] = Util::toInt($me['no']); -$_SESSION[DB::prefix().'p_name'] = $me['name']; -$_SESSION['p_time'] = time(); - -$date = date('Y-m-d H:i:s'); - -// -$query="update general set logcnt=logcnt+1,ip='{$_SESSION['p_ip']}',lastconnect='$date',conmsg='$conmsg' where owner='{$_SESSION['userID']}'"; -MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - -$date = date('Y_m_d H:i:s'); -$date2 = substr($date, 0, 10); -$fp = fopen("logs/_{$date2}_login.txt", "a"); -$msg = StringUtil::Fill2($date,20," ").tab2($id,13," ").StringUtil::Fill2($me['name'],13," ").StringUtil::Fill2($_SESSION['p_ip'],16," "); -fwrite($fp, $msg."\n"); -fclose($fp); - -header ("Location: index.php"); - -MYDB_close($connect); diff --git a/hwe/process_war.php b/hwe/process_war.php index 44504748..bb3f473f 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -1681,9 +1681,9 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { $alllog[] = "●{$game['month']}월:{$general['name']}(이)가 {$city['name']} 공략에 성공했습니다."; $log[] = "{$city['name']} 공략에 성공했습니다."; $history[] = "●{$game['year']}년 {$game['month']}월:【지배】{$nation['name']}(이)가 {$city['name']}(을)를 지배했습니다."; - addHistory($general, "●{$game['year']}년 {$game['month']}월:{$city['name']}(을)를 함락시킴"); - addNationHistory($nation, "●{$game['year']}년 {$game['month']}월:{$general['name']}(이)가 {$destnationName} {$city['name']}(을)를 점령"); - addNationHistory($destnation, "●{$game['year']}년 {$game['month']}월:{$nation['name']}{$general['name']}에 의해 {$city['name']}(이)가 함락"); + pushGeneralHistory($general, "●{$game['year']}년 {$game['month']}월:{$city['name']}(을)를 함락시킴"); + pushNationHistory($nation, "●{$game['year']}년 {$game['month']}월:{$general['name']}(이)가 {$destnationName} {$city['name']}(을)를 점령"); + pushNationHistory($destnation, "●{$game['year']}년 {$game['month']}월:{$nation['name']}{$general['name']}에 의해 {$city['name']}(이)가 함락"); $query = "select city from city where nation='{$city['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -1697,7 +1697,7 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { $losenation = MYDB_fetch_array($result); $history[] = "●{$game['year']}년 {$game['month']}월:【멸망】{$losenation['name']}(이)가 멸망하였습니다."; - addNationHistory($nation, "●{$game['year']}년 {$game['month']}월:{$losenation['name']}(을)를 정복"); + pushNationHistory($nation, "●{$game['year']}년 {$game['month']}월:{$losenation['name']}(을)를 정복"); $query = "select no from general where nation='{$general['nation']}' and level='12'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -1727,7 +1727,7 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { pushGenLog($gen, $genlog); - addHistory($gen, "●{$game['year']}년 {$game['month']}월:{$losenation['name']}(이)가 멸망"); + pushGeneralHistory($gen, "●{$game['year']}년 {$game['month']}월:{$losenation['name']}(이)가 멸망"); $loseGeneralGold += $loseGold; $loseGeneralRice += $loseRice; @@ -1895,8 +1895,8 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { $conquerNationArray = MYDB_fetch_array($conquerResult); $history[] = "●{$game['year']}년 {$game['month']}월:【분쟁협상】{$conquerNationArray['name']}(이)가 영토분쟁에서 우위를 점하여 {$city['name']}(을)를 양도받았습니다."; - addNationHistory($nation, "●{$game['year']}년 {$game['month']}월:{$city['name']}(을)를 {$conquerNationArray['name']}양도"); - addNationHistory($conquerNationArray, "●{$game['year']}년 {$game['month']}월:{$nation['name']}에서 {$city['name']}(을)를 양도 받음"); + pushNationHistory($nation, "●{$game['year']}년 {$game['month']}월:{$city['name']}(을)를 {$conquerNationArray['name']}양도"); + pushNationHistory($conquerNationArray, "●{$game['year']}년 {$game['month']}월:{$nation['name']}에서 {$city['name']}(을)를 양도 받음"); // 이동X 및 사기 변경 $query = "update general set atmos='{$general['atmos']}',killnum=killnum+1 where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/select_npc_post.php b/hwe/select_npc_post.php index 272e4c75..9fe1d286 100644 --- a/hwe/select_npc_post.php +++ b/hwe/select_npc_post.php @@ -86,7 +86,6 @@ if($admin['npcmode'] != 1) { $query = " update general set name2='{$member['name']}', - conmsg='', npc=1, killturn=6, mode=2, @@ -101,7 +100,7 @@ if($admin['npcmode'] != 1) { $me = MYDB_fetch_array($result); $log[0] = "●{$admin['month']}월:{$me['name']}의 육체에 {$member['name']}(이)가 빙의됩니다!"; - addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$me['name']}의 육체에 {$member['name']}(이)가 빙의되다."); + pushGeneralHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$me['name']}의 육체에 {$member['name']}(이)가 빙의되다."); pushGenLog($me, $mylog); pushGeneralPublicRecord($log, $admin['year'], $admin['month']); diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index ab4ea277..12b4266c 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -5,7 +5,6 @@ CREATE TABLE `general` ( `no` INT(11) NOT NULL AUTO_INCREMENT, `owner` INT(11) NOT NULL DEFAULT '0', - `conmsg` CHAR(255) NOT NULL DEFAULT '', `npcmsg` CHAR(255) NULL DEFAULT '', `npcid` INT(5) NULL DEFAULT NULL, `npc` INT(1) NULL DEFAULT '0', diff --git a/src/sammo/Session.php b/src/sammo/Session.php index 0e0514f9..f9752ba9 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -222,6 +222,11 @@ class Session { return $this; } + $db->update('general', [ + 'logcnt' => $db->sqleval('logcnt+1'), + 'ip' => Util::get_client_ip(true), + 'lastConnect' => date('Y-m-d H:i:s') + ], 'owner = %i', $userID); $this->set($serverID.static::GAME_KEY_DATE, $now); $this->set($serverID.static::GAME_KEY_GENERAL_ID, $generalID);