mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 23:42:32 +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('Access-Control-Allow-Origin: *');
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
require_once('class.php');
|
require_once('class.php');
|
||||||
|
$auth = new auth();
|
||||||
|
$auth->sessionStartIfNone();
|
||||||
|
if (isset($_SESSION['token'])) {
|
||||||
$idle = new idlers();
|
$idle = new idlers();
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||||
if (isset($_GET['type'])) {
|
if (isset($_GET['type'])) {
|
||||||
if ($_GET['type'] == 'server') {
|
if ($_GET['type'] == 'server') {
|
||||||
@ -98,3 +100,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
|||||||
die();
|
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