added back USERS_DIR
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
some refactoring
|
||||
|
||||
config added USERS_FILE
|
||||
config added USERS_DIR & USERS_FILE
|
||||
|
||||
# Multi File Upload & Edit
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ require 'config.php';
|
||||
session_start();
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$usersFile = UPLOAD_DIR . USERS_FILE;
|
||||
$usersFile = USERS_DIR . USERS_FILE;
|
||||
|
||||
// Determine if we are in setup mode:
|
||||
// - Query parameter setup=1 is passed
|
||||
|
||||
2
auth.php
2
auth.php
@@ -3,7 +3,7 @@ require 'config.php';
|
||||
session_start();
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$usersFile = UPLOAD_DIR . USERS_FILE;
|
||||
$usersFile = USERS_DIR . USERS_FILE;
|
||||
|
||||
// Function to authenticate user
|
||||
function authenticate($username, $password) {
|
||||
|
||||
@@ -4,7 +4,7 @@ session_start();
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Check if users.txt is empty or doesn't exist
|
||||
$usersFile = UPLOAD_DIR . USERS_FILE;
|
||||
$usersFile = USERS_DIR . USERS_FILE;
|
||||
if (!file_exists($usersFile) || trim(file_get_contents($usersFile)) === '') {
|
||||
// Return JSON indicating setup mode
|
||||
echo json_encode(["setup" => true]);
|
||||
|
||||
@@ -5,6 +5,7 @@ define('BASE_URL', 'http://yourwebsite/uploads/');
|
||||
define('TIMEZONE', 'America/New_York');
|
||||
define('DATE_TIME_FORMAT', 'm/d/y h:iA');
|
||||
define('TOTAL_UPLOAD_SIZE', '5G');
|
||||
define('USERS_DIR', '/var/www/uploads/');
|
||||
define('USERS_FILE', 'users.txt');
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
?>
|
||||
|
||||
@@ -7,7 +7,7 @@ if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true ||
|
||||
echo json_encode(["error" => "Unauthorized"]);
|
||||
exit;
|
||||
}
|
||||
$usersFile = UPLOAD_DIR . USERS_FILE;
|
||||
$usersFile = USERS_DIR . USERS_FILE;
|
||||
$users = [];
|
||||
if (file_exists($usersFile)) {
|
||||
$lines = file($usersFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
|
||||
@@ -3,7 +3,7 @@ require 'config.php';
|
||||
session_start();
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$usersFile = UPLOAD_DIR . USERS_FILE;
|
||||
$usersFile = USERS_DIR . USERS_FILE;
|
||||
|
||||
// Only allow admins to remove users
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user