<?php
session_start();
include("../snippets/autoload.php");
$entity = new UserAccount();

$entity->Email = $utils->SanitizeString($_POST["Email"]);
$entity->Password = $utils->SanitizeString($utils->EncryptWithoutReverse($_POST["Password"]));
$login = $entity->GetRecordLogin();
if(count($login)>0){
  if($login["IsCompany"]=="1"){
    $utils->SetSessionVar("COMPANY-USER","COMPANY");
  }else{
    $utils->SetSessionVar("COMPANY-USER","");
  }

  $utils->SetSessionVar("LOGGED-USER",$login["Id"]);
  $utils->SetSessionVar("PROFILE",2);
  echo "success";
  exit();
}