You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
934 B
32 lines
934 B
<?php
|
|
@include 'conn.conn';
|
|
$GLOBALS['conn'];
|
|
$conn=@mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb)or die("CONNECTION ERROR");
|
|
|
|
$content = null;
|
|
$content->status = array();
|
|
$data = json_decode(file_get_contents("php://input"));
|
|
|
|
if(isset($_GET['act']) && $_GET['act'] == 'login') {
|
|
if($data->usr == 'admin' && $data->pwd == 'JohnHolmes') {
|
|
$content->status = 200;
|
|
$content->authToken = base64_encode(date("Y-m-d"));
|
|
} else {
|
|
$content->status = 403;
|
|
}
|
|
} else if(isset($_GET['act']) && $_GET['act'] == 'check') {
|
|
if($data->token == base64_encode(date("Y-m-d"))) {
|
|
$content->status = 200;
|
|
$content->authToken = base64_encode(date("Y-m-d"));
|
|
} else {
|
|
$content->status = 403;
|
|
}
|
|
}
|
|
header("Access-Control-Allow-Origin: *");
|
|
header("Content-Type: application/json; charset=UTF-8");
|
|
header("Access-Control-Allow-Methods: POST");
|
|
header("Access-Control-Max-Age: 3600");
|
|
|
|
echo json_encode($content);
|
|
|
|
?>
|