a pastebin project

show all jpgs in dir

  1. <html>
  2. <body>
  3.  
  4. <?php
  5.  
  6. //  Define  the  full  path  to  your  folder,  shouldn't  need  changing
  7. $path  =  "./";
  8.  
  9. //  Open  the  folder
  10. $dir_handle  =  @opendir($path)  or  die("Unable  to  open  folder");
  11.  
  12. //  Loop  through  the  files
  13. while  (false  !==  ($file  =  readdir($dir_handle)))  {
  14.  
  15. //  Prevent  this  file  itself  being  shown
  16. //  If  you  want  it  to  not  display  any  other  files
  17. //  enter  more  of  these
  18. if($file  ==  "index.php")
  19. continue;
  20. //Prevent  folders  showing
  21. if($file  ==  ".")
  22. continue;
  23. if($file  ==  "..")
  24. continue;
  25.  
  26. //  Display  the  results
  27. echo  "<img  src='$file'  alt='$file'><br  />";
  28.  
  29. }
  30.  
  31. //  Close  it
  32. closedir($dir_handle);
  33.  
  34. ?>
  35.  
  36. </body>
  37. </html>

advertising

Create a Paste

Please enter your new post below (or upload a file instead):





Please note that information posted here will not expire by default. If you want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords.

fantasy-obligation
fantasy-obligation