<?php

include("ApiGlobalFunctions.php"); 

$keyglobal=$_POST['key_global'];
$url=$_POST['url'];
$include=includec($url);
error_log("URLCHECK: KEY: ".$keyglobal." url: ".$url." include: ".$include."\n", 3, "php.log");
if($include!='0' && $keyglobal=="OPF985697913" ){
     
    include ($include);
    $query=mysqli_query($link,"SELECT * FROM vtiger_tab WHERE  presence='0' AND name='Bodegas'");
    $num=mysqli_num_rows($query);
    if($num==1){
        $userarray[0]=array('Result'=>'1');
        error_log("URLCHECK: RESPONSE: 1"."\n", 3, "php.log");
        //echo json_encode($userarray);

    }else{
        $userarray[0]=array('Result'=>'2');//2
        error_log("URLCHECK: RESPONSE: 2"."\n", 3, "php.log");
        //echo json_encode($userarray);
    }
}else{
    $userarray[0]=array('Result'=>'0');//0
    error_log("URLCHECK: RESPONSE: 0"."\n", 3, "php.log");
     //echo json_encode($userarray);
}
echo json_encode(setDataJSON($userarray, 1));