SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tag to list directory?

    is there an html tag that will list the directory contents?

    ie:

    /folder/index.php displays a blank screen
    /folder/index.php?view=1 displays the folder listing

    PHP Code:
    <?php
    if ($_GET['view'])
    {
            <
    dir tag here>
    }
    ?>

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There isn't an HTML tag that does what you ask, but it is possible to list the directory using some more PHP commands. Is that what you need?


    Andy
    From the English nation to a US location.

  3. #3
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. i've been using a modified php code snip from php.net
    PHP Code:
    <?php 
    if (!$_GET['view'])
    {
        
    header('Location: /sneaky.php'); 
    }
    else
    {
    $dir "./";

    // Open a known directory, and proceed to read its contents
    if (is_dir($dir)) {
        if (
    $dh opendir($dir)) {
            while ((
    $file readdir($dh)) !== false) {
                echo 
    "<a href='$file'>$file</a> <br />\n";
            }
            
    closedir($dh);
        }
    }

    }
    ?>
    just hoped there might have been an html tag that could do this


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •