|
|
|
<HTML><HEAD><TITLE>Dir View</TITLE></HEAD>
<BODY BGCOLOR="#000000" TEXT="#aaaaaa" LINK="#888888" VLINK="#444444">
<CENTER><h1>PHP Directory Viewer</h1>Made by Dark Knite<BR><HR></CENTER>
<BR>
<table align="center" cellpadding="0">
<tr><TD> </DT><td>File Name</td><td>File Size</td><td>Description</td></tr>
<?php
// OK please don't hold it against me, I have stripped my original
// down a lot ot make it easy for you to understand. But it can very
// easyly be sooped but I'll leave that up to you. If you want to see
// this in action come to www.darkestknite.com and check it out.
// The only reason i learned PHP is so I can create a directory index
// viewer with a black background, if you know of another way PLEASE
// let me know. It would save me time designing god knows what.
//
// SECURITY:WATCH OUT BECAUSE IF THE QUERY_STRING IS ../../../..
// THE PHP TAKES IT AS BACK ONE DIRECTORY, BACK ONE MORE
// AND BACK ONE MORE YET, SO SOMEONE CAN GET TO THE ROOT
// WITHOUT MUCH PROBLEM, SO DESIGN SOME KIND OF CONDITION
// AGAINST IT BEFORE USING IT.
//
$temp = getenv( "QUERY_STRING");
$dir_name = "$temp";
if($dir_name == "") $dir_name = ".";
$handle=opendir($dir_name);
while ($file = readdir($handle)) { // Extract dir content
$filelst = "$filelst,$file";// save into string
}
closedir($handle);//
$filelist = explode(",",$filelst); // Brake string up into array
sort($filelist);
// sort the array acendingly, I suggest you make your own sort because this one sux
for ($count=1;$count<count($filelist);$count++) {
print "<TR>";
$filename=$filelist[$count];
$file_path = "$dir_name/$filename";
$filesize = filesize($file_path);
// You can use another function to format this, but you get the idea.
if (is_file($file_path)) {
// fleBLK.gif is a small icon of a file (draw yourself one and use that or use anything you want)
echo "<TD><img src=fleBLK.gif height=20 width=24></TD>";
echo "<TD><A HREF=\" $dir_name/$filename\" > $filename </A></TD>";
echo "<TD>$filesize bytes</TD>";
// I suggest you change "File" to a function returning a better description or remove it
completely (make sure you take them all out though)
echo "<TD>File</TD>";
}
elseif(($filename != ".") && ($filename != "..")) {
// DirBLK.gif is a small icon of a folder (draw yourself one and use that or use anything you
want)
echo "<TD><img src=DirBLK.gif height=20 width=24></TD>";
echo "<TD><A HREF=\"$filename\" > $filename </A></TD>";
echo "<TD> dir </TD>";
// I suggest you change "Directory" to a function returning a better description or remove it
completely (make sure you take them all out though)
echo "<TD>Directory</TD>";
}
print "</TR>";
}
?>
</table>
<center><HR>Made by Dark Knite for www.darkestknite.com<BR></center>
</BODY>
</HTML>
|
| Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML - Categories : PHP, Directories, FTP, Filesystem, HTML and PHP | | | Handle multiple file upload Categories : Complete Programs, Filesystem, PHP, HTML and PHP | | | Open directory and File download Categories : PHP, Filesystem, Directories, HTML and PHP | |
| | phpEasyMail: An easy way to send data from HTML-forms via EMail. Categories : Email, HTML and PHP, Complete Programs, PHP | | | List the content of the directory of your webserver where this small PHP Script resides. Categories : PHP, Filesystem, Directories, CSS | | | Validator 98 - a PHP-script to generate form-validation-code in JavaScript. Categories : Complete Programs, Java Script, PHP, HTML and PHP | | | Finds files on your site, uses UNIX find command. Categories : Complete Programs, Filesystem, PHP | | | upload function using PHP's FTP abilities. Categories : PHP, Filesystem, HTML and PHP | | | a file explorer for the web, filesystem php php3 files dirs directories pictures files windows linux system list ls scripts Categories : PHP, URLs, Directories, Filesystem | | | Disk Usage, uses UNIX du command. Categories : Complete Programs, PHP, Filesystem | | | phpCards - PHP/mySQL postcard script with web based admin to add, edit, and delete cards and categories. Very easy to install. Categories : PHP, Complete Programs, HTML and PHP, MySQL | | | grab directory listings into an array the example prints out each
subdirectory in the main dir - further work is to be performed on this one Categories : Filesystem, PHP, Directories, Search, Utilities | | | navbar.php3 - Dynamic hyperlinked navigation bars Categories : HTML and PHP, Arrays, PHP, Complete Programs | | | AITSH Statistics Categories : Complete Programs, Databases, HTML and PHP, Sessions, PHP | |
|
|