Api fix http code on home enter #2

This commit is contained in:
JonatanRek 2019-09-01 17:36:46 +02:00
parent c1fc666815
commit d08bfa8018

16
api.php
View File

@ -25,13 +25,17 @@ $obj = json_decode($json, true);
//zabespecit proti Ddosu //zabespecit proti Ddosu
if (isset($obj['user']) && $obj['user'] != ''){ if (isset($obj['user']) && $obj['user'] != ''){
//user at home //user at home
$user = UserManager::getUser($obj['user']); $user = UserManager::getUser($obj['user']);
$userId = $user['user_id']; if (!empty($user)) {
$keyWords = ['entered', 'connected', 'connected to', 'true']; $userId = $user['user_id'];
UserManager::atHome($userId, $obj['atHome']); if (is_bool($obj['atHome'])){
echo 'Saved'; UserManager::atHome($userId, $obj['atHome'] ? 'true' : 'false');
header("HTTP/1.1 200 OK"); echo 'Saved';
die(); header("HTTP/1.1 200 OK");
die();
}
}
} }
//Filtrování IP adress //Filtrování IP adress