<?php 
require 'db.php';
$data = json_decode(file_get_contents('php://input'), true);
if($data['email'] == '' or $data['mobile'] == '')
{
    $returnArr = array("ResponseCode"=>"401","Result"=>"false","ResponseMsg"=>"Something Went Wrong!");
}
else
{
    $shop_id = strip_tags(mysqli_real_escape_string($con,$data['shop_id']));
    $shop_code = strip_tags(mysqli_real_escape_string($con,$data['shop_code']));
    
    $search = $con->query("select * from user where email='".$data['email']."' and shop_id = '$shop_id' and shop_code = '$shop_code'");
    $search1 = $con->query("select * from user where mobile='".$data['mobile']."' and shop_id = '$shop_id' and shop_code = '$shop_code'");

    if($search->num_rows != 0)
    {
        $returnArr = array("ResponseCode"=>"200","Result"=>"false","ResponseMsg"=>"Email Already Registered");
    }
    else if($search1->num_rows != 0)
    {
        $returnArr = array("ResponseCode"=>"200","Result"=>"false","ResponseMsg"=>"Mobile Already Registered");
    }
    else
    {
      $returnArr = array("ResponseCode"=>"200","Result"=>"true","ResponseMsg"=>"OTP Sent Successfully!");
    }
}
echo json_encode($returnArr);
?>