Skip to content

Latest commit

 

History

History
749 lines (703 loc) · 22.8 KB

ReadMe.md

File metadata and controls

749 lines (703 loc) · 22.8 KB
<title>AutoIndex PHP Script: Readme</title>

AutoIndex PHP Script (version 2.2.7) - Tutorial File original by Justin Hagstrom, edited by Florin Ciprian Bodin Original AutoIndex is provided under the terms of the GNU General Public License (GPL) at http://autoindex.sourceforge.net/  .

This edition of AutoIndex lists the files in a directory tree and now is mobile screen reversible  .

AutoIndex since 2001 is a standalone PHP script that makes table that lists the files in a directory, and lets users access the files and subdirectories. It includes searching, icons for each file type, an admin panel, uploads, access logging, file descriptions, and more. Now this version developed in collaboration with the Beit Dina IT Unit was tested with PHP 5.3, 5.4, 5.5, 5.6, 7.1, 7.2, 7.3, 7.4 and is released with 35 languages packs.

Full Changelog: 2.2.6...2.2.7

This release has 4 assets: Visit the release page to download them.

DEMO: See PHP VERSION on Footer of the index page.

https://mxpcms.sourceforge.net/pub/

http://github.com/BeitDina/AutoIndex/
Please write any questions or comments at orynider@users.sourceforge.net .

To install simply upload the contents of this directory archive to a server with PHP support. Works with all versions of PHP with no DataBase required.
Then, point your browser to the index.php file in that folder. The first time you do this, it will take you to a configuration page.
To use all the default values, just click the button at the bottom, or customize it however you want.

On a live site at: http://beitdina.net/aleppo/  .

Information about the use of each variable is in this file.

base_dir is the folder that will be the root of the directory listing.
This will be the starting point for the script. Nothing above this directory can be viewed, but its subfolders can.
Make sure to use forward slashes, rather than backslashes. Also, try to use a relative path if possible.
Examples:

./ (the folder index.php is in)
./share folder/ (path relative to the php file)
/home/user/public_html/share_folder/ (absolute path)

If you're using an absolute path, you'll need to set force_download to TRUE (this is not recommended, though. It is better to use a path relative to the php script).

icon_path is the path to the icons. Don't put a slash at the end.
Leave this blank to not show icons to the left of files and folders.
Examples:

index_icons/winxp (relative to the php file)
/index_icons/kde (absolute path, relative to the server root)

stylesheet is the path and filename of your css stylesheet.
Just modify the one that came with this, so it will match the rest of your site.
Examples:

stylesheet.css (stylesheet.css is in the same folder as the php file)
/some_folder/some_stylesheet.css (absolute path to the stylesheet)

Optional Variables :

If allow_uploads is set to TRUE, people will be able to upload files to your website. (Default: FALSE)
But if use_login_system is also set to TRUE, you must create an account for them before they can upload.
The preset users are:

username: admin
password: admin
 
username: test or user
password: test or testtest


If you plan to use the login system, change the passwords or create different accounts and delete these!
All registered users will be able to upload, but only admins can create/delete accounts.
Also, if you want to allow uploads, make sure the folders you want to upload to are chmod'ed to allow PHP to write there.

user_list contains the path to the text file where the usernames and encrypted passwords are stored.
Make sure the file is chmod'ed so PHP can read and write to it.
(This is only needed if use_login_system is set to TRUE.)

If allow_file_overwrites is set to TRUE, when uploading a file that already exists, the file will be replaced. (Default: FALSE)
In other words, this will allow people to overwrite existing files by uploading new ones.
This variable only matters when allow_uploads is set to TRUE.

If must_login_to_download is set to TRUE, users must login before they will see the list of files. (Default: FALSE)
(They will not be able to download or browse through files without logging in first.)
This variable only matters when use_login_system is set to TRUE.

banned_list contains the path to the text file where blocked IP addresses and/or hostnames are stored.
This list can be edited by logging in as an administrator, or you can directly edit the text file and add IP addresses and/or hostnames, each on a new line.
You can use wildcards in the entries (*, ?, +).

If sub_folder_access is set to FALSE, folders will not be shown. (Default: TRUE)

index: Leave this blank unless you use php includes on your webpage.
Make sure to put "ob_start();" and "session_start();" at the top of your index file. This will make sure headers are sent correctly.
Examples:

?id=AutoIndex
/file.php?id=thisFile

The include in your index file should look something like this:

$valid = array('home', 'page1', 'page2');
if (isset($_REQUEST['id']) && in_array($_REQUEST['id'], $valid))
//if the id parameter in the URL is set, and it is in the 'valid' list
{
include($_REQUEST['id']); //include the file
}

hidden_files contains an array of strings.
If a file or folder matches any of them, it will not be displayed.
They may contain wildcards (*, +, ?). For example, to hide all php files, add '*.php' to the list, or if you want to hide all files that begin with a period, add '.*'

show_only_these_files contains an array of strings.
If there are any items in the array, the hidden_files variable will be disabled, and only files that are listed here will be shown.
They may contain wildcards (*, +, ?). For example, to show only .txt files, add '*.txt' to the list.

force_download should be set to TRUE or FALSE. (Default: FALSE)
If it is set to TRUE, the file will be automatically downloaded, instead of letting the person's browser decide.

bandwidth_limit is set to the max download speed (per client) in KB/s. 0 will turn it off.
The number can contain a decimal if you want.
NOTE: To use this feature, force_download must be set to TRUE.

anti_leech should be set to TRUE or FALSE. (Default: FALSE)
This will compare the referrer and the name of your site to make sure they clicked on a link to download a file.
Setting this equal to TRUE will prevent "leeching" by making sure they download files directly from a link on your site.
Since some people turn off referrer sending in their browser, this option is not recommended.

enable_searching should be set to TRUE or FALSE. (Default: TRUE)
If it is TRUE, people will be able to search for a file or folder containing a string.
It will search the folder you are currently in, and all subfolders.
Searching is not case sensitive.

The log_file contains the full path to the file to write the access log.
Leave it blank to turn off logging.
The log file can be a local file, or on an FTP server.
If it's a local file on non-windows systems, make sure the log file is chmod'ed to allow PHP to write to the file.
Example:

./log.txt (the folder the php file is in)
/home/user/public_html/share_folder/sharefile.log (absolute path)
ftp://user:password@example.com/sharefile.txt (stored on ftp server)

dont_log_these_ips contains an array of strings (which are IP addresses).
Any access from an IP on this list will not be written to the log file.
You can also add hostnames to the list, and use wildcards (*, +, ?).
(i.e. put your own IP in here so you don't fill up the log file when you access your site)

download_count contains a string which is the filename of the file to keep track of how many times files have been downloaded.
The file must be chmod'ed to allow PHP to read AND write to the file.
Leave blank to disable this feature.
NOTE: When downloading a file from an IP addresses in the dont_log_these_ips array, the count will NOT increase.

links_file contains the path to a text file with the URL of files that you want to be listed as links.
Separate each entry with a new line.
If you want, you can change how the links is displayed, by putting some text after a pipe ('|')

http://autoindex.sourceforge.net | Main Site
http://autoindex.sourceforge.net/forum/ | Forum

To add issues about this mobile edition rewriten for the Institute IT Unit go to: https://github.com/BeitDina/AutoIndex/issues

If no link description is present, the link itself will be displayed.
NOTE: This isn't really meant to be done by hand - you can use the built-in editor when you log in as an admin.

description_file contains the path to a text file with descriptions for files.
The format is: [base_dir][full filename and path][a pipe, '|'][description for file]
Here's an example: ./sharefile.txt|This is a text file.
Separate each entry with a new line.
NOTE: This isn't really meant to be done by hand: you can login as an admin and click "edit description" next to any file.

show_dir_size should be set to TRUE or FALSE. (Default: TRUE)
If it is set to TRUE, the total size of the folder will be shown under size.
If it is FALSE, it will display "[dir]" under size.
NOTE: If you are trying to index many files (meaning a few thousand), you will notice a speed improvement with this turned off.

folder_expansion should be set to TRUE or FALSE. (Default: FALSE)
If it is set to TRUE, when you click on the folder icon, it will expand the folder and list its contents.
Clicking on the folder name will take you into that folder.
If it is set to FALSE, both clicking on the icon and name will take you into the folder.

show_folder_count should be set to TRUE or FALSE. (Default: FALSE)
If it is TRUE, the total number of files in a folder will be shown next to that folder.
Files are counted recursively (files in subfolders are counted).

header and footer are the paths to 2 files.
The files must be text files (.html .txt .php , etc...)
Header will be displayed at the top, and footer will be displayed at the bottom.
Leave blank to not include a file.

header_per_folder and footer_per_folder should be set to TRUE or FALSE. (Default: FALSE)
If they are FALSE, the header/footer will be taken from the absolute or relative path in the header/footer variable.
If they are TRUE, the current directory will be added to the beginning of the file to be included. (don't add a path to the header/footer variables - just the filename)

days_new contains the number of days old a file can be and still have [New] written next to it. (Default: 0)
If it is set to 0, this feature will be disabled.
NOTE: this can contain any number, not just a 1 or 0 value, and it can contain a decimal if you want.

md5_show is a feature that will let users get the md5sum of a specific file. (Default: 0)
If set to 0 it will be disabled.
Otherwise, the number will represent the maximum file size (in megabytes) to allow the md5sum to be calculated (I'd recommend something close to 10).
The number can contain a decimal if you want.
NOTE: PHP version 4.2.0+ (or higher) was required for this feature to work and not is PHP 5.3+ (or higter).

thumbnail_height is a feature that will show thumbnails next to images. (NOTE: GDlib 2.0.1 or higher is required)
Setting it to 0 will disable this feature, and setting it to any other number will set the size of the thumbnail.
(100 is a good setting to start with.)

show_type_column, show_size_column, and show_date_column are set to TRUE or FALSE.
Setting them to TRUE will show the column, and setting it to FALSE will not display the column.


Language Settings:

lang is the default language to display the script in.
The choices for language file names are listed below...
(Default: 'en')

lang setting Language
al Albanian
bg Bulgarian
ca Catalan
cz Czech
da Danish
de German
ee Estonian
en English
eo Esperanto
es Spanish
fi Finnish
fr French
gr Greek
he Hebrew
hu Hungarian
is Icelandic
it Italian
jp Japanese
ko Korean
lt Lithuanian
lv Latvian
ms Malay
nl Dutch
no Norwegian
pl Polish
pt_BR Brazilian Portuguese
ro_RO Romanian
ru Russian
sk Slovak
sr_LA Serbian (Latin)
sr_CY Serbian (Cyrillic)
sv Swedish
th Thai
tr Turkish
vi Vietnamese
zh_CN Chinese
zh_TW Chinese Traditional

path_to_language_files is the path where the *.php language files are located.
Default: ./languages/

If select_language is set to TRUE, there will be an option at the bottom of the script for
the user to choose which language the script is displayed in. (Default: FALSE)


Folder Flag Settings:

flag is the default language flag to display the short iso code folder.
Some choices for iso folder are listed below...
(Default: 'en_us')

lang setting Language
al Albanian
bg Bulgarian
ca Catalan
cz Czech
da Danish
de_DE German Germany
ee Estonian
en_UK English UK
eo Esperanto
es_ES Spanish SPAIN
fi Finnish
fr French
el Greek
he Hebrew
hu Hungarian
is Icelandic
it Italian
jp Japanese
ko Korean
lt Lithuanian
lv Latvian
ms Malay
nl Dutch
no Norwegian
pl Polish
pt_BR Brazilian Portuguese
ro_RO Romanian
ru Russian
sk Slovak
sr_LA Serbian (Latin)
sr_CY Serbian (Cyrillic)
sv Swedish
th Thai
tr Turkish
vi Vietnamese
zh_CN Chinese
lzh or zh_TW Chinese Traditional

path_to_flag_files is the path where the *.png language flag images are located.
Default: ./flags/language/

If select_language is set to TRUE, there will be an option at the bottom of the script for
the user to choose which language the script is displayed in. (Default: FALSE)