43 lines
895 B
PHP
Executable File
43 lines
895 B
PHP
Executable File
<?php
|
|
|
|
ini_set('display_errors', 'Off'); // Suppress errors in AJAX response
|
|
session_start();
|
|
require_once '../init.php';
|
|
require_once '../config.php';
|
|
require_once '../libraries.php';
|
|
|
|
// Obtener y validar variables POST
|
|
$email = $_POST['email'] ?? '';
|
|
$password = $_POST['password'] ?? '';
|
|
|
|
if (empty($email) || empty($password)) {
|
|
echo 'fail[#]';
|
|
exit;
|
|
}
|
|
|
|
$empresa->setEmail($email);
|
|
$empresa->setPassword($password);
|
|
$empresa->setEmpresaId("15");
|
|
|
|
// Check for validation errors set by setEmail, setPassword, setEmpresaId
|
|
if($empresa->Util()->GetError())
|
|
{
|
|
$empresa->Util()->PrintErrors();
|
|
echo 'fail[#]';
|
|
exit;
|
|
}
|
|
|
|
if(!$empresa->DoLogin())
|
|
{
|
|
// If DoLogin itself sets errors (e.g., incorrect credentials), print them here
|
|
if($empresa->Util()->GetError()){
|
|
$empresa->Util()->PrintErrors();
|
|
}
|
|
echo 'fail[#]';
|
|
}
|
|
else
|
|
{
|
|
echo 'ok[#]ok';
|
|
}
|
|
|
|
?>
|