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 : 3.145.78.12


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

<?php

include("sys_connect.php");

if(!isset($_GET["emplcode"]) || $_GET["emplcode"] == "" ){
    echo json_encode(array("msg" => "Invalid Params", "error_code" => -1));
    die();    
}
$emplcode = $_GET["emplcode"];


$deptcode = $_GET["deptcode"];
$usertype = $_GET["usertype"];
$cond = "";
if(strtoupper($usertype) == 'ADMIN') {
    $cond = "and e.fdeptcode = '{$deptcode}'";
} else {
    $cond = "and e.frepthead = '{$emplcode}' and e.femplcode <> '{$emplcode}'";
}

$query = "select  d.fdeptcode, d.fdeptshrt as fdeptname, e.femplcode, e.femplname
from masempl e inner join masdept d on e.fdeptcode = d.fdeptcode
where ifnull(fusercode,'') <> '' and ifnull(fuserpswd,'') <> ''
and ifnull(femplstat,'') = 'T' and ifnull(fusercode,'') <> 'ADMIN' 
and ifnull(fblckuser,'') <> 'T' 
{$cond}
order by femplcode";
$myres = mysqli_query($mycon, $query);
$mycnt = mysqli_num_rows($myres);
if($mycnt > 0) {
    $res = [];
    $i = 0;
    while($row = mysqli_fetch_assoc($myres)){
        $res[$i] = $row;
        $i++;
    }
    echo json_encode(array("error_code" => 0, 'data' => $res ));
}
else {
    echo json_encode(array("error_code" => -1, 'data'=> [], 'msg' => "Data Not found!!!" ));
}