webcodebase.com Snippets database & Pastebin

Listing all files in a directory

Submitted on 01/12/2008
Authors Comment: A simple script for listing and outputting the files of a directory. Example for both a set directory and a $_GET directory.
How to use: If you want to use $_GET['dir'] instead of a set directory,

uncomment the $dir = $_GET[...
and comment the $dir = "ima...
Download Snippet:
Snippet:

  1. <?
  2.         // Directory:
  3.         // $dir = $_GET['dir'] . '/';
  4.            $dir = "images/";
  5.  
  6.         $files = scandir($dir);
  7.         foreach($files as $key => $value){
  8.                 $output .= $value;
  9.                 //You could add an icon in here maybe, a link to the file/directory, or a link to list files in that directory
  10.         }
  11.  
  12.         echo $value;
  13. ?>

 

Comments:

  1. .lbprvyoii | December 11, 2008 at 18:47

    8C04iq <a href="http://qkeegpinzsrr.com/">qkeegpinzsrr</a>, [url=http://nitmiarvxoff.com/]nitmiarvxoff[/url], [link=http://bstylvfuqzjq.com/]bstylvfuqzjq[/link], http://mofchdppgbjp.com/

  2. .cuwfmnx | December 11, 2008 at 18:47

    K8wvuy <a href="http://ilpbpfknrzix.com/">ilpbpfknrzix</a>, [url=http://xufqcoqzliuj.com/]xufqcoqzliuj[/url], [link=http://ojypbfavbosc.com/]ojypbfavbosc[/link], http://zuufrtjclukk.com/

  3. .fnnsgypng | December 11, 2008 at 18:47

    NN8mAB <a href="http://plbhebyawlfr.com/">plbhebyawlfr</a>, [url=http://bwejtekiykwu.com/]bwejtekiykwu[/url], [link=http://znovzokrvuto.com/]znovzokrvuto[/link], http://bvzknizbktbb.com/

  4. .oheangyn | December 11, 2008 at 18:47

    t0uikj <a href="http://miuldqyiknvn.com/">miuldqyiknvn</a>, [url=http://niqjwjumspwv.com/]niqjwjumspwv[/url], [link=http://gpkjfkeglakq.com/]gpkjfkeglakq[/link], http://ahpiztsfyjks.com/

  5. .nfzjrikdz | December 11, 2008 at 18:47

    f9xWno <a href="http://lqxiotrowxev.com/">lqxiotrowxev</a>, [url=http://mlhpqjsxuwyd.com/]mlhpqjsxuwyd[/url], [link=http://jagpixmlysci.com/]jagpixmlysci[/link], http://uzvqwgwlcdbo.com/

  6. .gcgozln | December 11, 2008 at 18:47

    vPTCJf <a href="http://qnpbhvlpudga.com/">qnpbhvlpudga</a>, [url=http://awqsnccoymal.com/]awqsnccoymal[/url], [link=http://fzzzrqljlgbo.com/]fzzzrqljlgbo[/link], http://hnzgikorchjb.com/

  7. .iywvthpl | December 11, 2008 at 18:47

    lxDKhw <a href="http://gvvkabfeixvw.com/">gvvkabfeixvw</a>, [url=http://qgoqofbamuwl.com/]qgoqofbamuwl[/url], [link=http://dfxwjkpvrifk.com/]dfxwjkpvrifk[/link], http://dpkgynefgxnd.com/

  8. .ofsqvwrs | December 11, 2008 at 18:47

    aKe2hB <a href="http://jxhcrwktixid.com/">jxhcrwktixid</a>, [url=http://mvlrzggusrvl.com/]mvlrzggusrvl[/url], [link=http://fvsutcmjaspe.com/]fvsutcmjaspe[/link], http://ummfcpuatare.com/


New Comment:
Name:
Comment:








Latest News

  • 30/12/09
    Webcodebase is BACK & New updates.
    Hello, Because of a jackass of a friend the main files for Webcodebase was deleted. I Thought everything was lost until i found a backup folder on my old linux box, so i restored WCB Back to its original state. The staff will continue posting snippets and fighting spam. We will also start releasing tools that web masters can use to check their scripts for vulnerabilities. These scripts will have special stars next to them and the "STAFF" tag. Please use these on your own systems only, we are NOT responsible for any damage they may do. We release them purely for educational purposes only! Thanks, Head of WCB, Arne AKA Cypher....
    [Read More]