Today I have came across a very weird error and trying to identifying it from last couple of hours but failed and posting here, maybe someone identify it. I have this code snippet (for brevity i am posting only relevant content).
if ($isSetCookies) {
//Set All Cookies
SetCookiesAtLogin($empDetails, $permissionColumn);
if (CheckAllowLoginWithoutMachine() == 0) {
//echo " returning, not allow from pc. . ";
return;
//when the session will be set ($isSetCookies is true) then, no data will be updated in switch person or em_curr_proj. It means that user is login through PC.
}
}
//Login the Person, without login machine is allowed
//login code logic below
LoginFromPC()
As you can see that, The LoginFromPC(last line of the code snippet) will only work if CheckAllowLoginWithoutMachine will return non zero output. I am pretty sure about it that isSetCookies is true and CheckAllowLoginWithoutMachine returning 0. When this thing will happen it will certainly not execute the LoginFromPC() Method. My question is that is this code error prone.? Because
it has failed as one of my user has logged-in, after attempting several times. I have also tried to create this error but it didn't create again so i am amazed why it occurred?
Edit: Upon request for More :
function CheckAllowLoginWithoutMachine(){
global $connPDO;
$sql = "SELECT AllowLoginWithoutMachine From tbl_allow_login_pms";
$data = $connPDO->query($sql)->fetch(PDO::FETCH_ASSOC);
return $data['AllowLoginWithoutMachine'];
}
while I am calling Login function Like this:
loginSetting(true)//$isSetCookies
Comments
Post a Comment