$this) { $_GET[$key] = stripslashes($this); } foreach ($_POST as $key => $this) { $_POST[$key] = stripslashes($this); } } //make sure all the variables are set correctly if (!isset($base_dir, $imagepath, $stylesheet, $use_login_system, $allow_uploads, $must_login_to_download, $userlist, $allow_file_overwrites, $log_file, $dont_log_these_ips, $download_count, $links_file, $description_file, $sub_folder_access, $index, $hidden_files, $show_only_these_files, $force_download, $bandwidth_limit, $anti_leech, $enable_searching, $show_dir_size, $folder_expansion, $show_folder_count, $days_new, $md5_show, $header, $footer, $header_per_folder, $footer_per_folder, $lang, $path_to_language_files, $select_language)) { die('
Error...
This script is not configured properly.
If you are the Webmaster, make sure you read the readme.html file, and set all the variables correctly.
'); } //find the user's IP address and hostname if (isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else if (isset($_SERVER['REMOTE_ADDR'])) { $ip = $_SERVER['REMOTE_ADDR']; } else { $ip = 'N/A'; } $host = @gethostbyaddr($ip) or $host = 'N/A'; //find the language the script should be displayed in if ($select_language && isset($_GET['lang']) && eregi('^[a-z]{2}(_[a-z]{2})?$', $_GET['lang']) && is_file($path_to_language_files.$_GET['lang'].'.php')) { $_SESSION['lang'] = $_GET['lang']; } else if (!isset($_SESSION['lang'])) { $_SESSION['lang'] = $lang; } @include($path_to_language_files.$_SESSION['lang'].'.php'); if (!isset($words)) { die('Error...
You need to include a language.php file that includes the variable $words.
Check the $lang and $path_to_language_files variables.
Make sure $base_dir has been assigned a value.
'); } if (ereg('[^/\\]$', $base_dir)) //make sure there is a slash at the end of base_dir { $base_dir .= '/'; } if (!is_dir($base_dir)) { die('Error...
This script is not configured properly.
'.htmlentities($base_dir)
.' is not a valid directory.
Check the $base_dir variable.
If you are the Webmaster, make sure you read the readme.html file, and set all the variables correctly.
'); } if (($base_dir[0] == '/' || $bandwidth_limit) && !$force_download) { 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 1, so that files can be downloaded. Otherwise, use a relative path instead of an absolute path or turn off $bandwidth_limit.
'); } if (!$sub_folder_access || $subdir == '/') { $subdir = ''; } else if (ereg('[^/\\]$', $subdir)) { $subdir .= '/'; //add a slash to the end if there isn't one } $dir = $base_dir.$subdir; //this will be displayed before any HTML output $htmlHeading = ''; if ($index == '') { $htmlHeading .= "\n".''; } if ($stylesheet != '') { $htmlHeading .= "\n\n"; } if ($index == '') { $htmlHeading .= "\nError...
Could not open the $userlist file.
Set $userlist to the correct file, or turn of the login system.
'); } function checkLogin($user, $pass) { global $userlist, $htmlHeading; ($users = @file($userlist)) or die("{$htmlHeading}Could not open file $userlist"); $user = strtolower($user); foreach ($users as $userInfo) { if (strtolower(substr(rtrim($userInfo), 33)) == $user && substr(rtrim($userInfo), 0, 32) == $pass) { return 1; } } return 0; } function loggedIn() { return (isset($_SESSION['user'], $_SESSION['pass']) && checkLogin($_SESSION['user'], $_SESSION['pass'])); } function isUserAdmin($user) { global $userlist, $htmlHeading; ($users = @file($userlist)) or die("{$htmlHeading}Could not open file $userlist"); $user = strtolower($user); foreach ($users as $userInfo) { if (strtolower(substr(rtrim($userInfo), 33)) == $user) { return (substr($userInfo, 32, 1) === '1'); } } return 0; } function isAdmin() { return isUserAdmin($_SESSION['user']); } function isUsername($user) { global $userlist, $htmlHeading; ($users = @file($userlist)) or die("{$htmlHeading}Could not open file $userlist"); $user = strtolower($user); foreach ($users as $userInfo) { if (strtolower(substr(rtrim($userInfo), 33)) == $user) { return 1; } } return 0; } function numAdmins() { global $userlist, $htmlHeading; $num = 0; ($users = @file($userlist)) or die("{$htmlHeading}Could not open file $userlist"); foreach ($users as $userInfo) { if (substr($userInfo, 32, 1) === '1') { $num++; } } return $num; } function get_filesize($size) //give a size in bytes, and this will return the appropriate measurement format { $size = max(0, $size); $u = array(' B', 'KB', 'MB', 'GB'); $i = 0; while ($size >= 1024 && $i < 4) { $size /= 1024; $i++; } return number_format($size, 1).' '.$u[$i]; } function getAllFiles($path) //Returns every file and folder in $path { $list = array(); if (($hndl = @opendir($path)) === false) { return $list; } while (($file=readdir($hndl)) !== false) { if ($file != '.' && $file != '..') { $list[] = $file; } } closedir($hndl); return $list; } function GetFileList($path) //Returns an array of filenames. Filters out "bad" files { global $sub_folder_access, $links_file; $f = $d = array(); $list = getAllFiles($path); for ($i=0; $iYou have been logged in. Continue.
'); } else { echo 'You must login to download and view files.
Login: '." |
Error: file does not exist.
'); } else if (filesize($file)/1048576 > $md5_show) { die($htmlHeading.'Error: file too big to find the md5sum of (according to the $md5_show variable).
'); } else { die(md5_file($file)); } } if (isset($_GET['sort'])) { $_SESSION['sort'] = $_GET['sort']; } else if (!isset($_SESSION['sort'])) { //'a' is ascending, 'd' is descending $_SESSION['sort'] = 'a'; } if (isset($_GET['sortMode'])) { $_SESSION['sortMode'] = $_GET['sortMode']; } else if (!isset($_SESSION['sortMode'])) { //'f' is filename, 's' is size, 'm' is date (modified), 'h' is downloads (hits), 'd' is description $_SESSION['sortMode'] = 'f'; } //size of the "chunks" that are read at a time from the file (when $force_download is on) $speed = ($bandwidth_limit ? $bandwidth_limit : 4); if ($folder_expansion) { if (!isset($_SESSION['expanded'])) { $_SESSION['expanded'] = array(); } if (isset($_GET['expand'])) { $temp = $dir.evalDir(rawurldecode($_GET['expand'])); if (strlen($temp) && is_dir($temp) && !in_array($temp, $_SESSION['expanded'])) { $_SESSION['expanded'][] = $temp; } } if (isset($_GET['collapse'])) { $temp = $dir.evalDir(rawurldecode($_GET['collapse'])); if (strlen($temp) && in_array($temp, $_SESSION['expanded'])) { array_splice($_SESSION['expanded'], array_search($temp, $_SESSION['expanded']), 1); } } } if ($allow_uploads && (!$use_login_system || loggedIn())) //Upload a file { if (isset($_FILES) && count($_FILES)) { $uploadedFiles = $errors = ''; for ($i=0; $iUploaded files: $uploadedFiles
Failed files: $errors
'); } else if (isset($_POST['numUpload'])) { echo "$htmlHeadingEnter the name of the folder you would like to create: |
Enter the new description for the file $filen: |
Enter the name of the remote file you would like to copy: |
';
$p = $dir.evalDir(rawurldecode($_GET['rename']));
if (isset($_GET['newName']))
{
$newName = $dir.evalDir(rawurldecode($_GET['newName']));
if ($p == $newName)
{
$msg = 'The filename is unchanged for ';
}
else if (@rename($p, $newName))
{
$msg = 'Rename successful for ';
if ($download_count != '')
{
$l = @file($download_count) or $l = array();
if ($h = @fopen($download_count, 'w'))
{
for ($i=0; $i |
Renaming '.htmlentities($p)."
New Filename: