At 06:11 16.06.2003, Sn!per said: --------------------[snip]-------------------- >I have several admin modules for my portal. And I have also several admin >users who are supposed to have access only to certain modules. > >Say, the superadmin can access ALL modules (modA, modB, modC, modD) and >admin-A can only access modA and modB >admin-B can only access modA and modD >... >... > >How can I setup my ACL that do bit (XOR) checking ? --------------------[snip]--------------------
You don't want to XOR but you want to OR (set bits) or to AND (test bits): define('AUTH_APP_A', 0x0001); define('AUTH_APP_B', 0x0002); define('AUTH_APP_C', 0x0004); define('AUTH_APP_D', 0x0008); $adminA->SetAccountRights(AUTH_APP_A | AUTH_APP_B); $adminA->SetAccountRights(AUTH_APP_A | AUTH_APP_D); // on top of AppA if (!($admin->GetAccountRights() & AUTH_APP_A) header('Location: main_menu.php'); // on top of AppB if (!($admin->GetAccountRights() & AUTH_APP_B) header('Location: main_menu.php'); // on top of AppC if (!($admin->GetAccountRights() & AUTH_APP_C) header('Location: main_menu.php'); // on top of AppD if (!($admin->GetAccountRights() & AUTH_APP_D) header('Location: main_menu.php'); This is fairly crude but quite efficient. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php