Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $maxlines=5000;
- $fp=fopen('log.txt','r');
- if(!$fp) exit("couldn't open log");
- if(isset($_GET['start'])) $start=$_GET['start']; else {
- $cnt=0;
- while(!feof($fp)){ $line=fgets($fp); $cnt++; }
- rewind($fp);
- if($cnt>$maxlines) $start=$cnt-$maxlines-1; else $start=0;
- }
- $i=0;
- while(!feof($fp)){
- $line=fgets($fp);
- if(empty(trim($line))) continue;
- if(strpos($line,'****')!==false) continue;
- if($i<$start){ $i++; continue; }
- echo $line;
- $i++;
- }
- echo "/*asdf*/$i"; // output separator and current highest line number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement