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

$myJSON=array();
if(isset($_POST["nekot"]) && isset($_POST["rnd"]))
{
	$toke = $_POST["nekot"];
if($toke == "sldiskdjgsoewmvmdpekdjghsncusi"){
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
        @mysqli_query($connect,"SET CHARACTER SET utf8;");
				$select = "SELECT payid,C_name,C_Code,type,p_cash,p_cheque,p_trans,p_date,p_comment,V_name,V_code,tbl_pays.V_id,tbl_pays.C_id FROM ".$tbl_customer.",".$tbl_visitors.",".$tbl_pays." WHERE ".$tbl_pays.".oked = '0' AND ".$tbl_customer.".id = ".$tbl_pays.".C_id AND ".$tbl_visitors.".id = ".$tbl_pays.".V_id";
				$result = @mysqli_query($connect,$select);
				if($result){
				while($rowt = @mysqli_fetch_assoc($result)){
						array_push($myJSON, $rowt);
					}
				}
				else{
					echo @mysqli_error($connect);
					return;
				}
		}
		else{
			echo "401";
			return;
		}
	}
}
else{
	echo "400";
	return;
}

echo json_encode($myJSON);

?>
