Code: Select all
<?php
//include the header
require("include/inc/header.php");
//Create variable path
if (empty($_GET['path']))
{
$_GET['path'] = "./";
}
$path = $_GET['path'];
//use the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<BR>";
//run the while loop
?><table border=1><tr><?php
while ($file = readdir($dir_handle))
{
if(($file != "index.php") && ($file != ".") && ($file != "..") && ($file != "localhost") && ($file != "include"))
{
if (is_dir($file))
{
echo "<td><a href="?path=$file"><img src="include/images/folder.gif" border="0" height="30" width="30"><br>$file</a></td>";
}
else
{
echo "<td><a href="$file" target="_blank"><img src=$file><br>$file</a></td>";
}
}
}
//close the directory
closedir($dir_handle);
?></tr></table><?php
//include the footer file
require("include/inc/footer.php");
?>I also am thinking of next/previous links, but not for now.
Ive tried a lot of stuff on this, someone please just give me some code or a hint.