This question already has an answer here:
I am expanding on someone else's code and came across this weird IF statement. The $_SESSION['Auth'] refers to an employees authorization level to determine which pages they can access. $level contains the different levels a page can be restricted to. However, I have no idea what that IF statement with only one "&" is actually doing. I have never seen something like this and can't find anything about it. If I need to post more of the code please request so with a comment.
foreach ($level as $l)
{
if ((integer)$l == 255)
{
if ($_SESSION['Auth'] == 255)
$allowed = true;
} else
if ($_SESSION['Auth'] & (integer)$l)
$allowed = true;
}
Aucun commentaire:
Enregistrer un commentaire