2023-03-24 12:41:27 -03:00
|
|
|
<?php
|
|
|
|
require_once 'clases/auth.class.php';
|
|
|
|
require_once 'clases/respuestas.class.php';
|
|
|
|
|
|
|
|
$_auth = new auth;
|
|
|
|
$_respuestas = new respuestas;
|
|
|
|
|
|
|
|
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
2023-03-24 17:25:43 -03:00
|
|
|
|
2023-03-24 12:41:27 -03:00
|
|
|
// recibir datos
|
|
|
|
$postBody = file_get_contents("php://input");
|
|
|
|
|
|
|
|
// envío de datos al manejador
|
|
|
|
$datosArray = $_auth->login($postBody);
|
2023-03-24 17:25:43 -03:00
|
|
|
|
2023-03-24 12:41:27 -03:00
|
|
|
// respuesta
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
if(isset($datosArray["result"]["error_id"])){
|
|
|
|
$responseCode = $datosArray["result"]["error_id"];
|
|
|
|
http_response_code($responseCode);
|
|
|
|
}else{
|
|
|
|
http_response_code(200);
|
|
|
|
}
|
|
|
|
echo json_encode($datosArray);
|
|
|
|
}else{
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$datosArray = $_respuestas->error_405();
|
|
|
|
echo json_encode($datosArray);
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|