This file cannot be accessed directly.

'); } if (!isset($stored_config, $config_generator)) //make sure variables in index.php are set { die('

Error: Filenames not defined. Check index.php to make sure $stored_config and $config_generator are set.

'); } if (count($_POST) == 38) { $final_output = " $current) { $current = str_replace('\'', '\\\'', str_replace('\\', '/', trim($current))); switch ($key) { case 'base_dir': if ($current == '') { die('

Error: Make sure $base_dir has been assigned a value.

'); } if (!preg_match('#/$#', $current)) //make sure there is a slash at the end of base_dir { $current .= '/'; } if (!@is_dir($current)) { die('

Error: $base_dir is not a valid directory.

'); } $final_output .= "\n/* Required settings: */\n\n\$$key = '$current';\n"; break; case 'icon_path': while (preg_match('#/$#', $current)) //make sure there is not a slash at the end { $current = substr($current, 0, -1); } case 'stylesheet': case 'user_list': case 'log_file': case 'download_count': case 'links_file': case 'description_file': case 'index': case 'header': case 'footer': case 'path_to_language_files': case 'lang': case 'banned_list': //strings $final_output .= "\$$key = '$current';\n"; break; case 'use_login_system': $final_output .= "\n\n/* Optional settings: */\n\n"; case 'allow_uploads': case 'must_login_to_download': case 'allow_file_overwrites': case 'sub_folder_access': case 'force_download': case 'anti_leech': case 'enable_searching': case 'show_dir_size': case 'folder_expansion': case 'show_folder_count': case 'header_per_folder': case 'footer_per_folder': case 'show_type_column': case 'show_size_column': case 'show_date_column': case 'select_language': //booleans if ($current != 'true' && $current != 'false') { die('

$'.htmlentities($key).' must be set to "true" or "false".

'); } $final_output .= "\$$key = $current;\n"; break; case 'thumbnail_height': case 'bandwidth_limit': case 'days_new': case 'md5_show': //numbers $current = (string)((float)$current); $final_output .= "\$$key = $current;\n"; break; case 'dont_log_these_ips': case 'hidden_files': case 'show_only_these_files': //arrays if ($current == '') { $temp = 'array();'; } else { $temp = 'array('; foreach (explode(',', $current) as $a) { $a = trim($a); if ($a != '') { $temp .= "\n\t\"$a\","; } } $temp = substr($temp, 0, -1) . ');'; } $final_output .= "\$$key = $temp\n"; break; default: die('

$'.htmlentities($key).' is not a valid configuration setting.

'); } } $final_output .= "\n?>"; $_POST['base_dir'] = str_replace('\\', '/', trim($_POST['base_dir'])); if ((preg_match('#^(/|[a-z]\:)#i', $_POST['base_dir']) || $_POST['bandwidth_limit'] != '0') && $_POST['force_download'] == 'false') { die('

Error: It seems you\'re using an absolute path for the base_dir, or bandwidth_limit is being used.
This requires that you have force_download turned on.

You must set force_download to "true" so files can be downloaded. Otherwise, use a relative path instead of an absolute path or turn off bandwidth_limit.

'); } if ($_POST['use_login_system'] == 'true' && !@is_file(trim($_POST['user_list']))) { die('

Error: Could not open the $user_list file.
Set $user_list to the correct file, or turn off the login system.

'); } if ($_POST['icon_path'] == '' && $_POST['folder_expansion'] == 'true') { die('

Error: You must use icons for the folder_expansion feature to work.
Set icon_path to the path where the icons can be found.

'); } if (@is_file($stored_config)) //if the file already exists, back it up { $temp_name = $stored_config.'.bak'; for ($i=1; @file_exists($temp_name); $i++) { $temp_name = $stored_config.'.bak'.(string)$i; } @copy($stored_config, $temp_name); } if ($h = @fopen($stored_config, 'wb')) //the file was opened successfully, so write to it { fwrite($h, $final_output); fclose($h); die('

Write successful!
AutoIndex configuration is finished.


'); } else //the file could not be written to, so now it must be downloaded through the browser { header("Content-Type: text/plain; name=\"$stored_config\""); header("Content-Disposition: attachment; filename=\"$stored_config\""); die($final_output); } } //begin display of main configuration page echo ''; ?> AutoIndex Configuration Generator
Polly po-cket

AutoIndex PHP Script

The default options are currently selected, so just press the configure button at the bottom to use them.
If you want to change them, though, it is important that you read the readme.html file, since it explains what each setting does.

Required Settings:

base_dir =
icon_path =
stylesheet =

Optional Settings:

use_login_system =
allow_uploads =
must_login_to_download =
user_list =
allow_file_overwrites =

log_file =
dont_log_these_ips = (Separate multiple items with commas.)
banned_list =
download_count =
links_file =
description_file =

sub_folder_access =
index =
hidden_files =
(Separate multiple items with commas.)
show_only_these_files = (Separate multiple items with commas.)

force_download =
bandwidth_limit = KB/s
anti_leech =

enable_searching =

show_dir_size =
folder_expansion =
show_folder_count =
days_new = days
md5_show = max size (MB)
thumbnail_height = (in pixels, 0 to disable. GDlib 2.0.1 or higher is required.)

header =
footer =
header_per_folder =
footer_per_folder =

show_type_column =
show_size_column =
show_date_column =

Language Settings:

path_to_language_files =
lang =
select_language =

When you press Configure, the script will attempt to write the config data to the file.
If it cannot (for example if it does not have write permission in the directory) the config file will be downloaded, and you will have to upload it to your server.
(It should be named and put in the same folder as index.php)