PHP Question

  • Started
  • Last post
  • 2 Responses
  • nearestexit

    I have an online directory and I'm using a simple PHP script to list the directory content. However, the script also lists the PHP file, which I'd prefer not be visible. Does anyone know how to hide or not read the index.php file (or any file type for that matter)?

    Here's my script:

    <?php /* function that reads directory content and returns the result as links to every file in the directory also it disply type wheather its a file or directory for any help please contact Chetan Akarte... */ function DirDisply($data) { $TrackDir=opendir("."); while ($file = readdir($TrackDir)) { if ($file == "." || $file == "..") { } else { print "<tr><td><font face=\" Arial, Verdana, Helvetica, sans-serif\"><a href=$file >$file</a></font> </td>";
    print "<td> ".filetype($file)."</td></tr><br>";

    }

    }
    closedir($TrackDir);

    return $data;
    }

    ?> <font face="Arial, Verdana, Helvetica, sans-serif">USHMM Propaganda Online Exhibition Dropbox</font>
    <p>
    <? @ DirDisply($data); ?>

  • blaw0

    while ($file = readdir($TrackDir) && $file != index.php)

    • Hm... that's not right. Perhaps check in the "if" statement to make sure it skips index.php (or whatever the script is named.blaw
  • acescence0

    if ($file != "." || $file != ".." || !strpos($file,".php"){

    • get rid of the else and move the prints into the ifacescence