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
Mobile Dev World

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 TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML -
Categories : PHP, Directories, FTP, Filesystem, HTML and PHP
aitor solozabal
Date : Feb 28th 2005
Grade : 3 of 5 (graded 19 times)
Viewed : 33428
File : 4089.zip
Images : No Images for this code example.
Search : More code by aitor solozabal
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

Application : WEB SERVER PHP DIRECTORY TREEVIEW FILE MANAGER/EXPLORER V.1.0
Name Program : dirtree.php, auxiliary sample calling program inidirtree.php
Author : Aitor Solozabal Merino (Spain)
Email : aitor-3@euskalnet.net
Date : 25-02-2005
Type : php program utility ( all in one )
Description : A file manager and directory treeview from any server path
: (hidden) outside or inside the Web Server Root, this path
: become the root for the treeview with features like
: File Filter Criteria, Login Users, Download file, Upload file
: Make dir, Remove dir, Rename dir, Erase file, Rename File.
: The treeview include the visualization of the total number of
: subdirs, files and bytes under every node displayed checking
: the current File Filter Extensions Criteria
: Developed & Tested in WAMP enviroment
: (Windows XP SP2, Apache 1, Mysql 4, Php 4)
Installation : Put this programs in a subfolder of the www of your web server
: document root directory
: Can be executed alone or with a calling external program
: (see "how" with Sample inidirtree.php)
Login User : with specific privileges
: loginuser="username" and password="userpassword"
: privileges = restricted
: loginuser="administrator" and password="adminpassword"
: privileges = all
=============================================================================
W A R N I N G S
Due to storing the full information of the tree directory in SUPERGLOBAL
$_SESSION arrays, the perfomance slow down when the number of nodes in the
directory treeview grows up - is acceptable up to 3.000 nodes (files)
The purpose is to manage a SUBDIR of a user, a project, a sharing zone, etc,
!!!!!! NOT THE FULL HARD DISK ¡¡¡¡¡¡¡¡
The LOGIN function is not professional, you must change it to accomodate to
your data base of users
=============================================================================
The server path can be indicated inside php code or captured with html FORM
and passed thru a SUPERGLOBAL variable $_POST or $_SESSION with a calling
external program (see "how" with Sample inidirtree.php)
Samples : $_POST['Server_Path']= "c:\x-files\top secret\rockwell"
: $_SESSION['Server_Path']= "c:\appserv\www\ftpzone"
This path will be the ROOT for the treeview
=============================================================================

Features of the 1.0 version:

Treeview directory - showing number of subfolders, files etc under every node
File filter extensions criteria - choose files to display and find them quickly
Download file - open or save at the client side (with or without compresssion)
Upload file - it does not rewrite an existing file in the server as a safe mode
Erase file - with user confirmation
Rename file - with user confirmation
Make directory - with user confirmation
Remove directory - with user confirmation. removes any subdir and file under
Rename directory - with user confirmation
Refresh process - to see changes made by other users
5 modes of file size visualization (bytes, kilobytes, megabytes, lines and % )
Turn a selected subdir into the treeview root
Compress a selected file
List contents of a selected compressed file
Email a selected file - (with previous compression or not)
Previously to use this function the SMTP parameter and the sendmail_From
parameter in the PHP.INI file must be set acordingly to your ISP smtp server.
(your_ip_server could be anything). See a sample extracted from PHP.INI:
[mail function]
; For Win32 only.
SMTP = smtp.your_ip_server.com
smtp_port = 25
; For Win32 only.
sendmail_from = address@your_ip_server.com

------------------------------------------------------------------------------
T O D O L I S T
------------------------------------------------------------------------------
1.- Full error checking to preserve and protect hidden real directory names
2.- Rearrange font sizes conforming the display screen resolution of the client
Variables $_SESSION['Width'] and $_SESSION['Height'] have the data pixels
3.- Aesthetic and professional improvements in tables, forms & backgrounds(CSS)
4.- Manage a virtual directory from a MySql database table with a SQL query
5.- Copy or move files between subdirs in the server
6.- Convert the full program in smaller units for a less consumption of memory
==============================================================================
                     FLOW DIAGRAM OF THE PROGRAM STRUCTURE
                             +-------------+
                             |    OTHER    |
      SAMPLE: INIDIRTREE.PHP |   CALLING   |
                             |   PROGRAM   |
                             +------+------+
                                    |
                                    V
                             +------+------+
+--------------------------->| DIRTREEVIEW |<----------------------------------+
| +------------------------->|   P  H  P   |                                   |
| |         +--------------->|   UTILITY   |<-------------------------------+  |
| |         |                +------+------+                                |  |
| |         |                       V                                       |  |
| |         |                  +----+----+                                  |  |
| |         |                  |  START  |                                  |  |
| |         |                  | SESSION |                                  |  |
| |         |                  +----+----+                                  |  |
| |         |                       V           +-----------------+ METHOD  |  |
| |         |                +------+------+ NO | "administrator" | "POST"  |  |
| |         |                | USERNAME ?  +--->+                 +-------->+  |
| |         |                +------+------+    | "adminpassword" |            |
| |         |                   YES V           +--------+--------+            |
| |         |             +---------+-------+     NO     |                     |
| |         |             |IS A VALID USER? +----------->+                     |
| |         |             +---------+-------+            |                     |
| |         |                   YES V                    |                     |
| |         |        +--------------+-------------+  NO  |                     |
| |         |        |IS A SESSION "AUTENTIFIED"? +----->+                     |
| |         |        +-----------------------+----+                            |
| |METHOD   | METHOD                         V YES                             |
| |"POST"   | "POST"                   +-----+------------------+              |
| |         |                      YES |   NO ACTIONS DEFINED   |              |
| |         |                     +----+          OR            |              |
| |         |                     |    |     "POST" ACTIONS     |              |
| |         |                     V    +-------------------+----+              |
| |    +----+--------+ YES +------+----------------+       |                   |
| |    + SELECT PATH +<----+IS EMPTY SERVER PATH ? |       |                   |
| |    +-------------+     +---------+-------------+       |                   |
| |          FORM                    V  NO                 |                   |
| |                        +---------+----------+          |                   |
| |                        |BUILD TREE STRUCTURE|          |NO                 |
| |          FORMS         +---------+----------+          |                   |
| |    +----------------+            V                     |                   |
| |  +-+ MAKE DIRECTORY +<-+         +-------------------->+                   |
| |  | +----------------+  |                               |                   |
| |  +-+REMOVE DIRECTORY+<-+                               |                   |
| |  | +----------------+  +  +--------------+             |                   |
| +<-+-+RENAME DIRECTORY+<-+<-+ DIR FUNCTIONS+<-+          |                   |
| |  | +----------------+  |  +--------------+  |          |                   |
| |  +-+BECAME TREE ROOT+<-+                    |          |                   |
| |  | +----------------+  |                    |          |            METHOD |
| |  +-+  UPLOAD FILE   +<-+                    |          V             "GET" |
| |    +----------------+                       |   +------+--------+          |
| |                                             +<--+ "GET" ACTIONS |          |
| |    +----------------+                       |   +------+--------+          |
| |  +-+  DOWNLOAD FILE +<-+                    |          |                   |
| |  | +----------------+  |                    |          |                   |
| |  +-+  RENAME FILE   +<-+                    |          |NO                 |
| |  | +----------------+  |  +--------------+  |          |                   |
| +<-+-+  ERASE FILE    +<-+<-+FILE FUNCTIONS+<-+          |                   |
| |  | +----------------+  |  +--------------+  |          |                   |
| |  +-+  EMAIL FILE    +<-+                    |          |                   |
| |  | +----------------+  |                    |          |                   |
| |  +-+  COMPRESS FILE +<-+                    |          |                   |
| |    +----------------+                       |          V                   |
| |                                             |  +-------+-------+           |
| |    +----------------+                       |  |    ACTIONS    |           |
| |  +-+  FILE FILTER   +<-+                    |  |EXPAND/COLLAPSE|           |
| |  | +----------------+  +  +--------------+  |  |  FULL EXPAND  |           |
| +<-+-+REFRESH TREEVIEW+<-+<-+ OTHER ACTIONS+<-+  +---+-----------+           |
|    | +----------------+  |  +--------------+         |                       |
|    +-+FILESIZE DISPLAY+<-+                           V                       |
|      +----------------+                  +-----------+-----+                 |
|                                          |DISPLAY TREEVIEW |                 |
|METHOD                                    +--------+--------+                 |
|"POST"                                             |                          |
|                                                   V                          |
|           FORM                                /---+---\                      |
|    +------------------+                      /  FINAL  \      +----------+   |
|    |   L O G O U T    |                     /  RESULT   \     |USER CLICK|   |
+<---+                  +<-------------------+   W  E  B   +--->+ON ACTIONS+-->+
     | SESSION DESTROY  |                     \  H T M L  /     |METHOD GET|
     +------------------+                      \ P A G E /      +----------+
                                                \-------/



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
Using PHP to Delete a directory with all sub directories and files using FTP
Categories : PHP, FTP, Directories, Filesystem
Open directory and File download
Categories : PHP, Filesystem, Directories, HTML and PHP
PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
List the content of the directory of your webserver where this small PHP Script resides.
Categories : PHP, Filesystem, Directories, CSS
Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support
Categories : PHP, FTP, Filesystem, PHP Classes, Compression
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
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
Moving folder hierarchy b/w server
Categories : PHP, FTP, Filesystem
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
Listing the 10 most recently updated files in a given dir by using last- modified variable and printing to html with link to the file
Categories : PHP, Directories, Filesystem
getDirArray(Path,Filter,Sorted): Returns an array of the files in a directory, filtered by regular expression and either sorted or randomized. Good for random pictures and graphics.
Categories : PHP, Filesystem, Directories
Fetching product details from the commission junction website using php
Categories : PHP, FTP, Filesystem, Compression
Opening and formatting text files into HTML on the fly- or HTML from templates.
Categories : PHP, HTML and PHP, Filesystem
 aitor solozabal merino wrote :1336
You can test his behaviour in http://usuarios.lycos.es/aitorsol/inidirtree.php