|
@@ -3,7 +3,9 @@
|
|
|
class serverLog {
|
|
class serverLog {
|
|
|
|
|
|
|
|
public static function printLog(string $_log){
|
|
public static function printLog(string $_log){
|
|
|
- if (stripos($_log, 'error') !== false) {
|
|
|
|
|
|
|
+ if (serverLog::startsWithIpDate($_log)) {
|
|
|
|
|
+ self::printLogAttempts($_log);
|
|
|
|
|
+ } elseif (stripos($_log, 'error') !== false) {
|
|
|
echo '<div class="error">' . $_log . '</div>';
|
|
echo '<div class="error">' . $_log . '</div>';
|
|
|
} elseif (stripos($_log, 'fatal') !== false) {
|
|
} elseif (stripos($_log, 'fatal') !== false) {
|
|
|
echo '<div class="error">' . $_log . '</div>';
|
|
echo '<div class="error">' . $_log . '</div>';
|
|
@@ -22,6 +24,39 @@ class serverLog {
|
|
|
self::printLog($log);
|
|
self::printLog($log);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static function startsWithIpDate(string $str): bool {
|
|
|
|
|
+ return preg_match(
|
|
|
|
|
+ '/^\d{1,3}(\.\d{1,3}){3},\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},/',
|
|
|
|
|
+ $str
|
|
|
|
|
+ ) === 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static function printLogAttempts(string $_log){
|
|
|
|
|
+ if (self::startsWithIpDate($_log)) {
|
|
|
|
|
+ $parts = explode(',', $_log, 4);
|
|
|
|
|
+ if (count($parts) === 4) {
|
|
|
|
|
+ echo '<div class="notice">'
|
|
|
|
|
+ . '<span style="color:#4FC3F7;">' . htmlspecialchars($parts[0]) . '</span>, '
|
|
|
|
|
+ . '<span style="color:#81C784;">' . htmlspecialchars($parts[1]) . '</span>, '
|
|
|
|
|
+ . '<span style="color:#FFD54F;">' . htmlspecialchars($parts[2]) . '</span>, '
|
|
|
|
|
+ . '<span style="color:#FF8A65;">' . htmlspecialchars($parts[3]) . '</span>'
|
|
|
|
|
+ . '</div>';
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ elseif (stripos($_log, 'error') !== false) {
|
|
|
|
|
+ echo '<div class="error">' . $_log . '</div>';
|
|
|
|
|
+ } elseif (stripos($_log, 'fatal') !== false) {
|
|
|
|
|
+ echo '<div class="error">' . $_log . '</div>';
|
|
|
|
|
+ } elseif (stripos($_log, 'warn') !== false OR stripos($_log, 'alert') !== false) {
|
|
|
|
|
+ echo '<div class="warning">' . $_log . '</div>';
|
|
|
|
|
+ } elseif (stripos($_log, 'notice') !== false) {
|
|
|
|
|
+ echo '<div class="notice">' . $_log . '</div>';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ echo '<div class="grey">' . $_log . '</div>';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private static function ifFolderWww(string $_log){
|
|
private static function ifFolderWww(string $_log){
|
|
|
return (stripos($_log, DOCUMENT_ROOT) !== false) ? TRUE : FALSE;
|
|
return (stripos($_log, DOCUMENT_ROOT) !== false) ? TRUE : FALSE;
|
|
|
}
|
|
}
|