mirror of
https://github.com/myronblair/tomtomgames
synced 2026-06-30 17:51:08 -05:00
19 lines
757 B
PHP
19 lines
757 B
PHP
<?php
|
|
// POST test - simulates exactly what the app does
|
|
ob_start();
|
|
try { require_once __DIR__ . '/../includes/auth.php'; } catch(Throwable $e) { ob_end_clean(); die(json_encode(['boot_error'=>$e->getMessage()])); }
|
|
ob_end_clean();
|
|
header('Content-Type: application/json');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$data = json_decode(file_get_contents('php://input'), true);
|
|
$result = loginUser($data['username'] ?? '', $data['password'] ?? '');
|
|
if ($result['success']) unset($result['user']['password']);
|
|
echo json_encode($result);
|
|
exit;
|
|
}
|
|
|
|
// GET - show users
|
|
$users = db()->query("SELECT id,username,alias,is_admin,email_verified,status FROM users")->fetchAll();
|
|
echo json_encode(['users'=>$users,'session_id'=>session_id()]);
|