mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 15:33:44 +01:00
Updated calls for user session
Users token session must be set for calls to work
This commit is contained in:
parent
5fafca6dd4
commit
c435d43137
11
calls.php
11
calls.php
@ -2,8 +2,10 @@
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Content-Type: application/json');
|
||||
require_once('class.php');
|
||||
$auth = new auth();
|
||||
$auth->sessionStartIfNone();
|
||||
if (isset($_SESSION['token'])) {
|
||||
$idle = new idlers();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (isset($_GET['type'])) {
|
||||
if ($_GET['type'] == 'server') {
|
||||
@ -98,3 +100,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
die();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
echo json_encode(array(
|
||||
'code' => 401,
|
||||
'message' => 'Unauthorized'));
|
||||
exit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user