%PDF- %PDF-
Direktori : /www/varak.net/www.varak.net/ |
Current File : /www/varak.net/www.varak.net/last.php |
<?php $num = $_GET['num'] ? $_GET['num'] : 50; $expr = $_GET['expr'] ? $_GET['expr'] : false; $file = "/www/varak.net/logs/custom_log"; header("Content-type: text/plain"); //passthru("tail -n $num /www/varak.net/logs/custom_log"); /*$lines = file("/www/varak.net/logs/custom_log"); $num2 = count($lines); for($i = count($lines)-$num; $i < $num2; $i++) { echo "$lines[$i]"; }*/ if($_GET['log']) { switch($_GET['log']) { case 'm-hosting': { $file = "/www/m-hosting.cz/logs/custom_log"; break; } case 'gmk': { $file = "/www/varak.net/htdocs80/logs/gmk.cz/custom_log"; break; } } } $f = fopen($file, "r"); if(!$f) { die; } $buff = array(); $i = 0; $num++; while(!feof($f)) { $line = fgets($f); if($expr) { while(!strstr($line, $expr) && !feof($f)) { $line = fgets($f); } } // vesele rotujici pole celkem setri pamet $i++; if($i == $num) { $i = 0; } $buff[$i] = $line; } $i--; for($j = $num-1; $j > 0; $j--) { $i++; if($i == $num) { $i = 0; } echo $buff[$i]; } //print_r($buff); fclose($f); ?>