give each user one or more role(s), put user info in $_SESSION['USER'], when login and test $_SESSION['USER']->role_id / $_SESSION['USER']['ROLES'] on each restricted site.
if users can have
only one role (simpel)
tbl_users
id, firstname, lastname, username, password, role_id
tbl_roles
id, name
if users can have
several roles (most flexible)
tbl_users
id, firstname, lastname, username, password
tbl_roles
id, name
tbl_map_user_role
id, user_id, role_id
i can see you er started on it, in your last question
https://www.computerworld.dk/eksperten/spm/1003862long time ago, as tvilling53 write in #1
test on each restricted site
(untested)
Example #1 in_array() example
$status = in_array( $_SESSION['USER']->role_id , array(1,4,6) )
if(!$status){
echo "not i array";
}
else{
echo "in array";
}
(untested)
test on one page
eks Example #3 in_array() with an array as needle
$status = in_array( $_SESSION['USER']['ROLES'] , array(1,4,6) )
if(!$status){
echo "not i array";
}
else{
echo "in array";
}
ref
http://php.net/manual/en/function.in-array.php