#!/usr/bin/php -q "._('Error').""._('Warning').""._('System').""._('Array').""._('Login')."

\n"; $file = realpath("/var/log/{$argv[1]}"); if ( (substr($file,0,9) == '/var/log/') && (is_file($file)) ) { $handle = popen('/usr/bin/tail -n 40 -f '.escapeshellarg($file).' 2>&1', 'r'); while (!feof($handle)) { $line = fgets($handle); if (strpos($line,'tail_log')!==false) continue; $span = "span"; foreach ($match as $type) foreach ($type['text'] as $text) if (preg_match("/$text/i",$line)) {$span = "span class='{$type['class']}'"; break 2;} echo "<$span>".htmlspecialchars($line).""; flush(); } pclose($handle); } ?>