Added authentication functionality and simple role based model
This commit is contained in:
18
me.php
Normal file
18
me.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
require 'auth.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if (!is_logged_in()) {
|
||||
echo json_encode(['logged_in' => false]);
|
||||
exit;
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'logged_in' => true,
|
||||
'user' => [
|
||||
'id' => intval($_SESSION['user']['id']),
|
||||
'email' => $_SESSION['user']['email'],
|
||||
'role' => $_SESSION['user']['role'],
|
||||
'can_manage_settings' => intval($_SESSION['user']['can_manage_settings']),
|
||||
]
|
||||
]);
|
||||
Reference in New Issue
Block a user