$user, 'pass' => $password));
$opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
$context = stream_context_create($opts);
$apiHost = 'http://torresunidas.com/FPeru/authenticate_user.php?' . $postdata;
// $jsonstatus = file_get_contents($apiHost, false, $context);
// $jsonstatus = file_get_contents($apiHost);
$jsonstatus = file_get_contents("http://torresunidas.com/FPeru/authenticate_user.php?user=ftu&pass=ftu");
var_dump($jsonstatus);
// echo "
";
// echo "Fnish Call";
// echo $jsonstatus;
$usuario = json_decode($jsonstatus);
$status = $usuario->status;
$data = $usuario->data;
if($status!= 200){
return 1;
}
else {
$iduser = intval($data->iduser);
$countryCodeU = $data->countryCodeU;
return 1;
}
}
if(!isset($_SESSION['iduser']))
{
if(isset($_POST['login']))
{
if(verificar_login($_POST['user'],$_POST['password'],$iduser,$countryCodeU) == 1)
{
$_SESSION['iduser'] = $iduser;
$_SESSION['countryCodeU'] = $countryCodeU;
header("location:./listaFacturas.php");
} else {
echo '