<?php
// Include the database configuration file

header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");

require_once('config.php');
require_once('f_resize_imagepath.php');

$User_id = $_REQUEST["User_id"];
$User_Pwd = $_REQUEST["User_Pwd"];
$User_name = $_REQUEST["User_name"];
$Expr_date = $_REQUEST["Expr_date"];
$sys_admin = $_REQUEST["sys_admin"];
$account_lock = $_REQUEST["account_lock"];
$dis_auto_lock = $_REQUEST["dis_auto_lock"];
$def_site_cd = $_REQUEST["def_site_cd"];
$def_lang = $_REQUEST["def_lang"];


$sql = "SELECT exits = count(*) FROM master.dbo.syslogins WHERE name ='".$User_id."'";

$stmt = sqlsrv_query($conn, $sql);

if (!$stmt) {
	$error_message = "Error selecting table (dsh_mst)";
	returnError($error_message);
	die(print_r(sqlsrv_errors(), true));
}


while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
		
	$json_work_grp[] = $row;
		
}

sqlsrv_free_stmt($stmt);
	


function returnData() {
    $returnData = array(
        'status' => 'SUCCESS',
    );
    
    echo json_encode($returnData);
}

function returnError($error_message) {
    $json = array();
    
    $returnData = array(
        'status' => 'ERROR',
        'message' => $error_message,
        'data' => $json
    );
    
    echo json_encode($returnData);
    exit();
}
?>
