2011-08-04 22:09:29 [INFO] <RichyBoyWonder> Anyway, G & I are enjoying it 2011-08-04 22:09:40 [INFO] [dynmap] ?[WEB] 86.154.231.70: ?Anyway, night. Will be back tomorrow with no Sian to bother me. She going away for Christening 2011-08-04 22:09:49 [INFO] [dynmap] ?[WEB] 86.154.231.70: ?whie I'm stuck in work 2011-08-04 22:10:00 [INFO] <RichyBoyWonder> I may or may not be around 2011-08-04 22:10:16 [INFO] [dynmap] ?[WEB] 86.154.231.70: ?If you are see you over the weekend. If not have a good weekend# 2011-08-04 22:10:20 [INFO] <RichyBoyWonder> Visiting G's Dad as he's not too well 2011-08-04 22:10:27 [INFO] <RichyBoyWonder> You too squire 2011-08-04 22:10:30 [INFO] [dynmap] ?[WEB] 86.154.231.70: ?:( Sorry to hear that 2011-08-04 22:10:51 [INFO] [dynmap] ?[WEB] 86.154.231.70: ?Bye 2011-08-04 22:10:56 [INFO] <RichyBoyWonder> Ciao
<? $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.')'; }