<?php

$r = array();
require_once __DIR__ . '/db_config.php';

if (isset($_POST["email"])) {
$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());
$email = $_POST['email'];

$query="SELECT f.latitude,f.longitude,b.geofencing,b.geo_distance  
FROM signupdetails s 
INNER JOIN emp_facility emp ON emp.emp_id=s.emp_id AND s.emailid=emp.emp_emailid
INNER JOIN atmdetails f ON f.id = emp.atmdetail_id
INNER JOIN b2lcustomers b ON f.companyname=b.companyname
WHERE s.emailid='$email' ";


    $result = mysqli_query($con,$query);
    if(!empty($result) && mysqli_num_rows($result) > 0){
        $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
         $r = $row;
        $r["s"] = 1;        
    }else{
        $r["s"] = 0;
    }
    
mysqli_close($con);               
echo json_encode($r);
}
?>