This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation in any version
of the License.
This program is non professional and distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=============================================================================
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 slows down when the number of nodes in the
directory treeview increases - up to 3.000 nodes (files) are acceptable
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 accommodate
your database of users
=============================================================================
The server path can be indicated inside php code or captured with html FORM
and passed through 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 there 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 to 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 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 SERVER PATH EMPTY ? | | |
| | +-------------+ +---------+-------------+ | |
| | FORM V NO | |
| | +---------+----------+ | |
| | |BUILD TREE STRUCTURE| |NO |
| | FORMS +---------+----------+ | |
| | +----------------+ V | |
| | +-+ MAKE DIRECTORY +<-+ +-------------------->+ |
| | | +----------------+ | | |
| | +-+REMOVE DIRECTORY+<-+ | |
| | | +----------------+ + +--------------+ | |
| +<-+-+RENAME DIRECTORY+<-+<-+ DIR FUNCTIONS+<-+ | |
| | | +----------------+ | +--------------+ | | |
| | +-+BECOME 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 / +----------+
\-------/
*/