From 717b4d45c2270f7578aa3e8216885ff95992654a Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 22 Feb 2025 11:30:35 -0500 Subject: [PATCH] check users.txt --- checkAuth.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/checkAuth.php b/checkAuth.php index 5aa5834..493ef83 100644 --- a/checkAuth.php +++ b/checkAuth.php @@ -2,6 +2,14 @@ session_start(); header('Content-Type: application/json'); +// Check if users.txt is empty or doesn't exist +$usersFile = __DIR__ . '/users.txt'; +if (!file_exists($usersFile) || trim(file_get_contents($usersFile)) === '') { + // Return JSON indicating setup mode + echo json_encode(["setup" => true]); + exit(); +} + if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) { echo json_encode(["authenticated" => false]); exit;