[GH-ISSUE #1363] Feature requesr #866

Open
opened 2026-03-02 16:01:54 +03:00 by kerem · 1 comment
Owner

Originally created by @softlab on GitHub (Dec 18, 2025).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/1363

Hello!

Could you please add the ability to redefine usernames and passwords in an external PHP file?
In tinyfilemanager.php, you could wrap $use_auth, $auth_users, and $readonly_users with if (!isset(...)) {} checks, like this:
This would allow defining these variables externally without modifying the core file.

tinyfilemanager.php:
// Auth with login/password
// set true/false to enable/disable it
// Is independent from IP white- and blacklisting
if (!isset($use_auth)) {
$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
if (!isset($auth_users)) {
$auth_users = array(
'admin' => '$2y$10$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', //admin@123
'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345
);
}
// Readonly users
// e.g. array('users', 'guest', ...)
if (!isset($readonly_users)) {
$readonly_users = array(
'user'
);
}

Then later I could invoke filemanager.php from my index.php as follows:

password_hash('MyStrongPassword', PASSWORD_BCRYPT), 'user' => password_hash('AnotherPassword', PASSWORD_BCRYPT), ]; require __DIR__ . '/vendor/tinyfilemanager/tinyfilemanager.php'; Thank you very match, Yurii
Originally created by @softlab on GitHub (Dec 18, 2025). Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/1363 Hello! Could you please add the ability to redefine usernames and passwords in an external PHP file? In tinyfilemanager.php, you could wrap $use_auth, $auth_users, and $readonly_users with if (!isset(...)) {} checks, like this: This would allow defining these variables externally without modifying the core file. tinyfilemanager.php: // Auth with login/password // set true/false to enable/disable it // Is independent from IP white- and blacklisting if (!isset($use_auth)) { $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 if (!isset($auth_users)) { $auth_users = array( 'admin' => '$2y$10$/K.hjNr84lLNDt8fTXjoI.DBp6PpeyoJ.mGwrrLuCZfAwfSAGqhOW', //admin@123 'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345 ); } // Readonly users // e.g. array('users', 'guest', ...) if (!isset($readonly_users)) { $readonly_users = array( 'user' ); } Then later I could invoke filemanager.php from my index.php as follows: <?php $auth_users = [ 'admin' => password_hash('MyStrongPassword', PASSWORD_BCRYPT), 'user' => password_hash('AnotherPassword', PASSWORD_BCRYPT), ]; require __DIR__ . '/vendor/tinyfilemanager/tinyfilemanager.php'; Thank you very match, Yurii
Author
Owner

@prasathmani commented on GitHub (Dec 19, 2025):

github.com/prasathmani/tinyfilemanager@dd79258999/tinyfilemanager.php (L145)

you can configure external config file - https://tinyfilemanager.github.io/config-sample.txt

<!-- gh-comment-id:3672854124 --> @prasathmani commented on GitHub (Dec 19, 2025): https://github.com/prasathmani/tinyfilemanager/blob/dd79258999a90872061cb01db59a5e52aeb4c2db/tinyfilemanager.php#L145 you can configure external config file - https://tinyfilemanager.github.io/config-sample.txt
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tinyfilemanager#866
No description provided.