Tinyfilemanager 2.4.3 -

header('WWW-Authenticate: Basic realm="TinyFileManager"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authentication required'; exit;

// Allowed extensions (empty = all) $allowed_extensions = array( 'jpg','jpeg','png','gif','pdf','txt','doc','docx','xls','xlsx', 'zip','tar','gz','mp3','mp4','php','html','css','js' );

exit;

<?php // TinyFileManager 2.4.3 // https://github.com/prasathmani/tinyfilemanager // Released under MIT License session_name('filemanager'); session_start();

// Root path for file manager $root_path = $_SERVER['DOCUMENT_ROOT']; tinyfilemanager 2.4.3

// Simple auth check function auth($users, $read_only_users = array()) if (!isset($_SESSION['loggedin'])) if (isset($_SERVER['PHP_AUTH_USER']) && isset($users[$_SERVER['PHP_AUTH_USER']])) $pass = $_SERVER['PHP_AUTH_PW']; $hash = $users[$_SERVER['PHP_AUTH_USER']]; if (password_verify($pass, $hash)) $_SESSION['loggedin'] = $_SERVER['PHP_AUTH_USER']; $_SESSION['readonly'] = in_array($_SERVER['PHP_AUTH_USER'], $read_only_users); return true;

function list_directory($path, $show_hidden) $files = scandir($path); $result = array('dirs' => array(), 'files' => array()); foreach ($files as $file) $file === '..') continue; if (!$show_hidden && $file[0] === '.') continue; $full = $path . '/' . $file; if (is_dir($full)) $result['dirs'][] = $file; else $result['files'][] = $file; $_POST['action'] : (isset($_GET['action'])

// Actions $action = isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '');