Advertisement
Guest User

PHP

a guest
Oct 31st, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2.  
  3. $dir = opendir(".");
  4. while($entryName = readdir($dir)) {
  5. $dirArray[] = $entryName;
  6. }
  7. closedir($dir);
  8.  
  9. $indexCount = count($dirArray);
  10. ?>
  11. <header class="hgroup-dir">
  12. <h4>Directory</h4>
  13. </header>
  14. <section id="sidedir">
  15. <p>
  16. <?php
  17. echo $indexCount . " files found<br />";?>
  18. </p>
  19. <ul>
  20. <?php
  21. for($index = 0; $index < $indexCount; $index++) {
  22. if($dirArray[$index] != "." && $dirArray[$index] != "..") {
  23. $type = filetype($dirArray[$index]);
  24.  
  25. if ($type == "dir") {
  26. echo "<img src='images/folder.gif'>";
  27. } else {
  28. "<img src=''>";
  29. }
  30. echo "
  31.  
  32. <li>
  33. <a href='".$dirArray[$index]."' target='_blank'>
  34. ".$dirArray[$index]."
  35. </a>
  36. </li>";
  37. }
  38. }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement