Add user environment variable support

This commit is contained in:
brittany mitchell 2025-12-20 20:05:37 -06:00
commit 936022476d
6 changed files with 237 additions and 66 deletions

View file

@ -2,6 +2,9 @@
//Default Configuration
$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"theme":"light"}';
// If running locally with PHP, use the env variable
// $env = parse_ini_file('.env');
/**
* H3K ~ Tiny File Manager V2.6
* @author CCP Programmers
@ -24,11 +27,8 @@ $use_auth = true;
// Login user name and password
// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)
// Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html
$auth_users = array(
'admin' => '$2y$10$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', //admin@123
'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345
);
// Generate secure password hash - pwd.html
$auth_users = json_decode(getenv('USERS'), true);
// Readonly users
// e.g. array('users', 'guest', ...)
@ -213,7 +213,7 @@ if ($report_errors == true) {
// if fm included
if (defined('FM_EMBED')) {
$use_auth = false;
$use_auth = true;
$sticky_navbar = false;
} else {
@set_time_limit(600);