<? $things = file('server.log'); $chats = Array(); foreach ($things as $thing) { if (strpos($thing, "[INFO] <")) { $chats[] = "[" . substr($thing, 11, 5) . "]" . htmlspecialchars(substr($thing, 27)); } else if (strpos($thing, "[dynmap]")) { $thing = str_replace(": ?", ": ", $thing); $chats[] = "[" . substr($thing, 11, 5) . "]" . htmlspecialchars(substr($thing, 37)); } } $chatt = implode("<br />", array_slice($chats, -30)); echo $chatt; ?>
:D Thanks!
The ? are because of pasting, there's some colour formatting from dynmap to make it green.
2011-08-04 22:09:49 [INFO] [dynmap] §2[WEB] 86.154.231.70: §fwhie I'm stuck in work
else if ( strpos($this,"logged in") ) { $time = "[" . substr($thing, 11, 5) . "]"; $person = preg_match( '/(?<=\[INFO\] )\S+/' , $thing ); $chats[] = $time.' <i>Joined:</i> <b>'.htmlspecialchars($person).'</b>'; } else if ( strpos($thing,"lost connection") ) { $time = "[" . substr($thing, 11, 5) . "]"; $person = preg_match( '/(?<=\[INFO\] )\S+/' , $thing ); $reason = substr(strrchr($thing, '.'), 1); $chats[] = $time.' <i>Disconnected:</i> <b>'.htmlspecialchars($person).'</b> ('.$reason.')'; }
The stupid download doesn't seem to want to finish. :(
Gets to 484 of 507 KB and just stops.
That was Firefox, but Chrome is doing same. "506/507 kB, 0 secs left".
If I copy and rename the file I can't extract the zip because it's corrupt, because it's got a stupid kilobyte missing. :@