File Explorer";//Variable that will store all of the HTML
$user_dir = isset($_GET['d'])? $_GET['d'] : "";
//Uses this files location to get the directory and then looks for 'files' folder
//make sure the folder is here, or change this variable
$dir = substr(__FILE__, 0, strrpos(__FILE__, '/'))."files$user_dir";
//Checks to see if they are trying to get out of your folder and roam your filesystem
if(strpos($user_dir, "..") !== false)
{
$page .= "Please do not try and hack the website. You have been reported to Bosses";
/**
* You must have php configured to send mail before including this bit
*/
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: File Explorer Notifier ' . "\r\n";//customize me
<--more-->
//mail($webmaster, "Someone tried to hack admin/documents",
// "
",
// $headers);
return $page;
}
/*BREADCRUMBS*/
$cur_path = explode("\\", $user_dir);
$temp_path = "";//stores the url for the increasing breadcrumb
$page .= "
";
//loops through the current directory and puts links in breadcrumb form
// Top --> dir1 --> dir1_1 --> dir1_1_2
for($cc=0;$cc{$cur_path[$cc]}";
}
}
$page .= "
";
//Tries to open the directory
$m = opendir($dir);
if($m !== false)//vaild directory
{
//if there is a file to be uploaded and the user has permission
if(isset($_FILES['uploadMe']) && $boss)
{
$name = "$dir\\[".time()."] - ".filename_safe($_FILES["uploadMe"]["name"]);//makes the filename safe
if(move_uploaded_file($_FILES["uploadMe"]["tmp_name"], $name))
$page .= "
Uploaded file to $name
";
else
$page .= "
An error occured
".var_export($_FILES, true)."
";
}
//if there is a directory to be created and the user has permission
if(isset($_POST['newdir']) && $boss)
{
$name = "$dir\\".filename_safe($_POST['newdir']);//makes the directory name safe
if(mkdir($name))//create directory
$page .= "
Created Folder: $name
";
else
$page .= "
Unable to create directory
";
}
$page .= "
Name
Size
Last Modified
Last Accessed
Last Created
"; /** * Icons taken from: http://www.erichynds...ples/famfamfam/ */ $folder_icon = ""; //check source for picture source $file_icon = ""; //check source for picture source //Loops through the opened directory, displays all files and directories $numfiles = 0;//stores the number of files it finds $numfolders = 0;//stores the number of folders it finds while (false !== ($file = readdir($m))) { if($file == "." || $file == "..") continue; $f = "$dir\\$file"; $page .= "
"; if(is_dir($f))//checks if directory { $numfolders++; $page .= "