<?php
require_once ("varables.php");

$myJSON=array();
if(isset($_POST["nekot"]) && isset($_POST["an1d"]))
{
  if($_POST["nekot"] == "abmnbjfkdlsAjdkgpdjgjs"){
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
        @mysqli_query($connect,"SET CHARACTER SET utf8;");

			$query_all = "SELECT ".$tbl_orders.".id,".$tbl_orders.".date,".$tbl_customer.".C_name,".$tbl_visitors.".V_name,".$tbl_orders.".endprice,".$tbl_orders.".emergency,".$tbl_customer.".C_id,".$tbl_visitors.".V_id,".$tbl_orders.".comment,".$tbl_orders.".paytype FROM ".$tbl_visitors.", ".$tbl_orders.", ".$tbl_customer." WHERE ".$tbl_orders.".C_id = ".$tbl_customer.".id AND ".$tbl_orders.".V_id = ".$tbl_visitors.".id AND ".$tbl_orders.".localed = '0' ORDER BY ".$tbl_orders.".emergency";
			$result = @mysqli_query($connect,$query_all);
			if($result){
				while($row = @mysqli_fetch_assoc($result))	{
					array_push($myJSON, $row);
				}

			}
				else {
				echo "400";
        return;
			 }




	}
	 else
   {
		echo "402";
    return;
  }
  }
  else {	echo "405";
    return;
  }
}

echo json_encode($myJSON);
?>
