Page Access Advice using SA - Updated
I have a table of users which need to log in to access protected page content,
My current rules set is as follows;
$comparisons[0] = array(TRUE, "".((isset($_SESSION['mob_sesh']))?$_SESSION['mob_sesh']:"") ."", 2, "0");
$comparisons[1] = array(TRUE, "".$row_rsWho['mob_perm'] ."", 6, "1");
$comparisons[2] = array(TRUE, "".$row_rsWho['mob_status'] ."", 2, "0");
The user can access protected pages if they have logged in and have an active session
mob_sesh <> 0
mob_perm => 1
mob_status = 1 (0 will restrict access)
with the above configuration in place, it still allows users access where the mob_perm = 0
(mob_perm takes president and should prevent access if the value = 0)
Is it the order?
Where is this going wrong?
Thanks, Paul.
Update:
so I changed the order to
$comparisons[0] = array(TRUE, "".$row_rsWho['mob_status'] ."", 2, "");
$comparisons[1] = array(TRUE, "".((isset($_SESSION['mob_sesh']))?$_SESSION['mob_sesh']:"") ."", 2, "");
$comparisons[2] = array(TRUE, "".$row_rsWho['mob_perm'] ."", 6, "1");
The logic being, if the first condition wasnt met it was game over, no access.
Also i stripped out the zeros from the compare to field. For some reason, it prefers to compare against a blank "".
Anyways, ive got the desired behavior as a result.