Access LoginStatus variable from API Action
Posted: Sat Aug 06, 2022 12:50 pm
Hi all. Please help me. I have a global variable $LoginStatus
in Page_Rendering. How can i access to this variable and pass it in API Action?
function Page_Rendering()
{
//Log("Page Rendering");
global $LoginStatus;
$LoginStatus= $LoginStatus["currentUserName"];
//Log("Page Rendering");
}
$app->get('/updatetaikhoansocai/{name}', function ($request, $response, $args) {
$name = $args["name"] ?? null; // Get the input value
if ($name !== null) {
global $LoginStatus;
ExecuteUpdate("UPDATE tbl_nks_employees set filtertaikhoan = '" . AdjustSql($name)."' where Username='".$LoginStatus . "'");
}
return $response; // Return Psr\Http\Message\ResponseInterface object
});