Add .gitignore and project files
This commit is contained in:
21
check_auth_status.php
Normal file
21
check_auth_status.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// check_auth_status.php
|
||||
session_start();
|
||||
|
||||
$response = [
|
||||
'loggedIn' => isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true
|
||||
];
|
||||
|
||||
if ($response['loggedIn']) {
|
||||
$response['user'] = [
|
||||
'user_id' => $_SESSION['user_id'] ?? 0,
|
||||
'email' => $_SESSION['user_email'] ?? '',
|
||||
'full_name' => $_SESSION['full_name'] ?? '',
|
||||
'is_admin' => $_SESSION['isAdmin'] ?? false,
|
||||
'login_time' => $_SESSION['login_time'] ?? time()
|
||||
];
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($response);
|
||||
?>
|
||||
Reference in New Issue
Block a user