<?php 

include("config.inc.php"); ?>
<?php
$user = $_GET['user'];
$pass = $_GET['pass'];
if($pass =="" || $user == ""){
    header("Location: ".$arrConfig['url_site']."failedlogin.php");
    exit();
}
$numTerminal = $_SESSION['numTerminal'];
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt_array($curl, array(
  CURLOPT_URL => $arrConfig["url_api"].'verificaCredenciais?user='.$user.'&pass='.$pass.'&numTerminal='.$numTerminal,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  
));

$response = curl_exec($curl);

curl_close($curl);

echo $response;


if($response != "[-1]"){
    $_SESSION['user'] = $user;
    header("Location: ".$arrConfig['url_site']."maquina.php");
    exit();
}
else{
    header("Location: ".$arrConfig['url_site']."failedlogin.php");
    exit();
}





?>