diff --git a/README.md b/README.md index e320f8e..de8f590 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,12 @@ main screen **Changes 3/3/2025:** + folder management added + some refactoring - + + config added USERS_FILE # Multi File Upload & Edit diff --git a/addUser.php b/addUser.php index e1ed3ec..1b2ee90 100644 --- a/addUser.php +++ b/addUser.php @@ -3,7 +3,7 @@ require 'config.php'; session_start(); header('Content-Type: application/json'); -$usersFile = USERS_FILE; +$usersFile = UPLOAD_DIR . USERS_FILE; // Determine if we are in setup mode: // - Query parameter setup=1 is passed diff --git a/auth.php b/auth.php index c17190d..6b819b7 100644 --- a/auth.php +++ b/auth.php @@ -3,7 +3,7 @@ require 'config.php'; session_start(); header('Content-Type: application/json'); -$usersFile = USERS_FILE; +$usersFile = UPLOAD_DIR . USERS_FILE; // Function to authenticate user function authenticate($username, $password) { diff --git a/checkAuth.php b/checkAuth.php index 01af5a8..586903a 100644 --- a/checkAuth.php +++ b/checkAuth.php @@ -4,7 +4,7 @@ session_start(); header('Content-Type: application/json'); // Check if users.txt is empty or doesn't exist -$usersFile = USERS_FILE; +$usersFile = UPLOAD_DIR . USERS_FILE; if (!file_exists($usersFile) || trim(file_get_contents($usersFile)) === '') { // Return JSON indicating setup mode echo json_encode(["setup" => true]); diff --git a/config.php b/config.php index 282a9d7..e5a1ea1 100644 --- a/config.php +++ b/config.php @@ -5,6 +5,6 @@ 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_FILE', '/var/www/uploads/users.txt'); +define('USERS_FILE', 'users.txt'); date_default_timezone_set(TIMEZONE); ?> diff --git a/getUsers.php b/getUsers.php index 3f32913..7d78a81 100644 --- a/getUsers.php +++ b/getUsers.php @@ -7,7 +7,7 @@ if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true || echo json_encode(["error" => "Unauthorized"]); exit; } -$usersFile = USERS_FILE; +$usersFile = UPLOAD_DIR . USERS_FILE; $users = []; if (file_exists($usersFile)) { $lines = file($usersFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); diff --git a/removeUser.php b/removeUser.php index 60245b8..4d13f12 100644 --- a/removeUser.php +++ b/removeUser.php @@ -3,7 +3,7 @@ require 'config.php'; session_start(); header('Content-Type: application/json'); -$usersFile = USERS_FILE; +$usersFile = UPLOAD_DIR . USERS_FILE; // Only allow admins to remove users if (