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

$myJSON['message'] = "خطای اعتبار صنجی";
$myJSON['mmm'] = array();
if(isset($_POST["an1d"]) && isset($_POST["netok"]))
{
	$id = $_POST["netok"];
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
        @mysqli_query($connect,"SET CHARACTER SET utf8;");
        $query_token = "SELECT id FROM tbl_notifications WHERE type = 'C' AND id > '".$id."' ORDER BY id DESC LIMIT 1";
		$tokres=@mysqli_query($connect,$query_token);
        if (!$tokres) {
            $myJSON['message']= @mysqli_error($connect) ;
        }
		else{
			while($row = @mysqli_fetch_assoc($tokres))
				$myJSON['message'] = $row["id"];
			}
	}
	 else
		 $myJSON['message']="خطای برقرار ارتباط با پایگاه داده";
}
    echo json_encode($myJSON);

?>
