logfile not exits, if bot running?"; exit; } if (filesize($logfile)<=5048) { echo "logfile loading..."; exit; } $fp=fopen($logfile, "r"); $pos=-1; // bugfix?.... \n ??? $t=" "; $c=1; $lastlines=50; $out=""; $outarray=array(); while ($c < $lastlines) { fseek($fp, $pos, SEEK_END); $t=fgetc($fp); $out=$t.$out; $pos=$pos - 1; if ($t=="\n") { $c++; $outarray[]=$out; // if string length $out != 0 $out=""; } // if ($t=="\n") } // while ($c < $lastlines) fclose($fp); foreach(array_reverse($outarray) as $line){ echo $line; } // foreach(array_reverse($outarray) as $line) } // function end ?>