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.

30 lines
756 B

<?php
@include 'conn.conn';
$GLOBALS['conn'];
$conn=@mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb)or die("CONNECTION ERROR");
$content = null;
$content->status = 404;
if(isset($_POST['act']) && $_POST['act'] == 'auth') {
if($_POST['usr'] == 'admin' && $_POST['pwd'] == 'JohnHolmes') {
$content->status = 200;
$content->authToken = md5(date("Y-m-d"));
} else {
$content->status = 403;
}
} else if(isset($_POST['act']) && $_POST['act'] == 'check') {
if($_POST['token'] == md5(date("Y-m-d"))) {
$content->status = 200;
$content->authToken = md5(date("Y-m-d"));
} else {
$content->status = 403;
}
}
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
echo json_encode($content);
?>