트래픽 버그 수정

This commit was merged in pull request #86.
This commit is contained in:
2018-04-29 01:58:59 +09:00
parent 13fccb998e
commit a1397e41aa
2 changed files with 18 additions and 16 deletions
+10 -10
View File
@@ -22,15 +22,15 @@ $refresh = [];
$online = []; $online = [];
$curonline = getOnlineNum(); $curonline = getOnlineNum();
$visibleLogs = min(11, count($log)); foreach($log as $i=>$value){
for ($i=0; $i < $visibleLogs; $i++) { $parse = Json::decode($value);
$parse = explode("|", $log[count($log)-$visibleLogs+$i]); $date[$i] = $parse[0];
$date[$i] = trim($parse[0]); $year[$i] = $parse[1];
$year[$i] = trim($parse[1]); $month[$i] = $parse[2];
$month[$i] = trim($parse[2]); $refresh[$i] = $parse[3];
$refresh[$i] = trim($parse[3]); $online[$i] = $parse[4];
$online[$i] = trim($parse[4]);
} }
if ($game['maxrefresh'] == 0) { if ($game['maxrefresh'] == 0) {
$game['maxrefresh'] = 1; $game['maxrefresh'] = 1;
} }
@@ -63,7 +63,7 @@ if ($game['maxonline'] < $curonline) {
<table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr> <tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr>
<?php <?php
for ($i=0; $i < $visibleLogs; $i++) { foreach($log as $i=>$value){
$w = round($refresh[$i] / $game['maxrefresh'] * 100, 1); $w = round($refresh[$i] / $game['maxrefresh'] * 100, 1);
if ($w >= 100) { if ($w >= 100) {
$w -= 0.1; $w -= 0.1;
@@ -133,7 +133,7 @@ $dt = date('H:i');
<table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 자</font></td></tr> <tr><td colspan=4 align=center id=bg2><font size=5>접 속 자</font></td></tr>
<?php <?php
for ($i=0; $i < $visibleLogs; $i++) { foreach($log as $i=>$value){
$w = round($online[$i] / $game['maxonline'] * 100, 1); $w = round($online[$i] / $game['maxonline'] * 100, 1);
if ($w >= 100) { if ($w >= 100) {
$w -= 0.1; $w -= 0.1;
+8 -6
View File
@@ -1349,12 +1349,14 @@ function updateTraffic() {
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
//일시|년|월|총갱신|접속자|최다갱신자 //일시|년|월|총갱신|접속자|최다갱신자
file_put_contents(__dir__."/logs/_traffic.txt", file_put_contents(__dir__."/logs/_traffic.txt",
StringUtil::padStringAlignRight($date,20," ") Json::encode([
."|".StringUtil::padStringAlignRight($game['year'],3," ") $date,
."|".StringUtil::padStringAlignRight($game['month'],2," ") $game['year'],
."|".StringUtil::padStringAlignRight($game['refresh'],8," ") $game['month'],
."|".StringUtil::padStringAlignRight($online,5," ") $game['refresh'],
."|".StringUtil::padStringAlignRight($user['name']."(".$user['refresh'].")",20," ") $online,
$user['name']."(".$user['refresh'].")"
])."\n"
, FILE_APPEND); , FILE_APPEND);
} }