WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Directory viewer, customize how you display the file structure, easy to understand. Found out about PHP 3 days ago, and this is my first prog.
Categories : HTML and PHP, Complete Programs, Directories, Filesystem, PHP Update Picture
Dark Knite
Date : Jan 05th 2000
Grade : 1 of 5 (graded 1 times)
Viewed : 18124
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Dark Knite
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<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