<?php
$dbHost = 'localhost';
$dbUser = 'safehunter_admindb';
$dbPass = 'dcm-1269';
$dbName = 'safehunter_asfaleies';
$dbC = mysqli_connect($dbHost, $dbUser, $dbPass, $dbName) or die('Error Connecting to MySQL DataBase');	  
						  
mysqli_query($dbC,"SET NAMES 'utf8'");
mysqli_query($dbC,"SET CHARACTER SET 'utf8'");
$query = "Select * from asf_pelates";
$result = mysqli_query($dbC,$query) or die(mysqli_error());
$expired=0;
$today=0;
$this_month=0;

while($row=mysqli_fetch_array($result)){
	if(strtotime(date('d-m-Y'))>strtotime($row['Im_mexri'])){
		$expired++;
	}
	if(strtotime(date('d-m-Y'))==strtotime($row['Im_mexri'])){
		$today++;
	}
	if(strtotime(date('d-m-Y'))<=strtotime($row['Im_mexri']) && strtotime('last day of this month')>=strtotime($row['Im_mexri'])){
		$this_month++;
	}
}
// echo 'expired='.$expired.'&';
echo json_encode([$today, $expired, $this_month]);
?>