Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

George

By: a guest on Jan 31st, 2008  |  syntax: PHP  |  size: 0.75 KB  |  hits: 2,229  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <html>
  2. <head>
  3.         <title>List of files</title>
  4. </head>
  5. <body>
  6. <?php
  7. $thelist = array();
  8. $dir = './';
  9. if ($handle = opendir($dir)) {
  10.         while (false !== ($file = readdir($handle))) {
  11.                 if ($file != "." && $file != "..") {
  12.                         $file = $dir.$file;
  13.                         $thelist[] = array('file' => $file, 'filemtime' => filemtime($file), 'filesize' => filesize($file));
  14.                 }
  15.         }
  16.  
  17.         closedir($handle);
  18. }
  19. ?>
  20. <p>
  21. <table><tr><td><strong>File name</strong></td><td><strong>File Size</strong></td><td><strong>File Last Modification Time</strong></td></tr>
  22. <?php
  23. for($i = 0; $i < count($thelist); $i++) {
  24.         ?><tr><td><?=$thelist[$i]['file']?></td><td><?=$thelist[$i]['filesize'];?></td><td><?=$thelist[$i]['filemtime'];?></td></tr><?php
  25. }
  26. ?>
  27. </table>
  28. </p>
  29.  
  30. </body>
  31. </html>