Guest User

listfiles.php

a guest
Oct 18th, 2014
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. $log_dir = '/var/log/mikrotik';
  4.  
  5.  
  6.  
  7. echo '<html><head><title>List of Log Files</title><link href="style.css" rel="stylesheet" type="text/css"></head>';
  8.  
  9. // print the header
  10. echo '<table class="header"><tr class="header"><th class="header" align="left"><a class="header" href="./listfiles.php">';
  11. echo 'Mikrotik Router Log Viewer</a>';
  12. echo '</th><th class="header" align="right">';
  13. echo date("Y.m.d");
  14. echo '</th></tr></table>';
  15.  
  16. echo '<body>';
  17. echo '<p><br></p>';
  18.  
  19.  
  20.  
  21.  
  22.  
  23. $files = scandir($log_dir,0);
  24. if($files != FALSE){
  25.     // no error ocured
  26.    
  27.     echo '<table class="listfiles"><tr><th class="listfiles">Log Files</th></tr>';
  28.     foreach($files as $line){
  29.         $ext = end(explode(".",$line));
  30.         if($ext == "log"){
  31.            
  32.             echo '<tr class="listfiles"><td class="listfiles">';
  33.             echo '<a class="listfiles" href="./showlog.php?logfile='.$line.'">'.$line.'</a>';
  34.             echo '</td></tr>';     
  35.         }
  36.            
  37.        
  38.     }
  39.     echo '</table>';
  40. }
  41.  
  42. echo '</body></html>';
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment