diff --git a/getUsers.php b/getUsers.php index fd30fbc..9e46464 100644 --- a/getUsers.php +++ b/getUsers.php @@ -1 +1,21 @@ -{"error":"Unauthorized"} \ No newline at end of file + "Unauthorized"]); + exit; +} +$usersFile = 'users.txt'; +$users = []; +if (file_exists($usersFile)) { + $lines = file($usersFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + foreach ($lines as $line) { + $parts = explode(':', trim($line)); + if (count($parts) >= 3) { + $users[] = ["username" => $parts[0]]; + } + } +} +echo json_encode($users); +?>