Ejemplo n.º 1
0
<?php

require_once "../Models/General.php";
require_once "../Models/PDO.php";
require_once "../Models/User.Model.php";
csUser_02::__Log_Out();
$User = new csUser_02();
$Email = filter_input(INPUT_POST, 'Email');
$Password = filter_input(INPUT_POST, 'Password');
$User->__Set__Credentials($Email, $Password);
if ($User->Id != -1) {
    $Response = $User->__Log_In();
} else {
    $Response = array('Error_Code' => -1);
}
header('Content-type: application/json');
echo json_encode($Response);
Ejemplo n.º 2
0
<?php

require_once "../Models/General.php";
require_once "../Models/User.Model.php";
require_once "../Models/PDO.php";
$Email = filter_input(INPUT_POST, 'Email');
$Password = filter_input(INPUT_POST, 'Password');
$User = new csUser_01($Email);
if ($User->Id == -1) {
    $Response = $User->__Register($Password);
    if (array_key_exists('Id', $Response)) {
        $User_Logged = new csUser_02();
        $User_Logged->__Set__Registerd($Response[Id], $User->Email);
        $Response = $User_Logged->__Log_In();
    }
} else {
    $Response = array('Error_Code' => -2);
}
header('Content-type: application/json');
echo json_encode($Response);