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

$myJSON['visitorrout'] = array();
$myJSON['success']="0";
if(isset($_POST["nekot"]) && isset($_POST["an1d"]))
{
    $id =$_POST["an1d"];
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
        @mysqli_query($connect,"SET CHARACTER SET utf8;");
		if($id == 0 || $id == null){
				$myJSON['success']="404";
		}
		else if($id >0){
			$query_one = "SELECT ".$tbl_routs.".id,".$tbl_routs.".name,".$tbl_visitor_routs.".vrid FROM ".$tbl_routs.",".$tbl_visitor_routs." WHERE ".$tbl_visitor_routs.".V_id = '".$id."' AND  ".$tbl_visitor_routs.".R_id = ".$tbl_routs.".id";
			$oneres = @mysqli_query($connect,$query_one);
			if($oneres){
			 while($row = @mysqli_fetch_assoc($oneres))
				array_push($myJSON["visitorrout"], $row);
				$myJSON['success']="200";
			}
			else echo @mysqli_error($connect);
		}
		
	}
	 else
		 $myJSON['success']="402";
}
echo json_encode($myJSON);
?>