richardsanchez@hotmail Posted September 5, 2010 Share Posted September 5, 2010 Hello can someone point me into the right direction? I've got this code: if ($userdata["user_level"] <> 1 ){ die(); } The above code works but now I want to give users with level 3 also acces but not the users having level 2. Anyone has an idea? Regards Richard Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted September 5, 2010 Share Posted September 5, 2010 Try the following if ($userdata["user_level"] != 1 && $userdata["user_level"] != 3){ die(); } Regards, Paul. Quote Link to comment Share on other sites More sharing options...
richardsanchez@hotmail Posted September 5, 2010 Author Share Posted September 5, 2010 Thx it works! Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 5, 2010 Share Posted September 5, 2010 Or you could just go: if($userdata['user_level'] == 2){ die('Wrong user level.'); } Or if you end up with a few levels that are restricted. $restricted = array(2, 4, 5, 7); // levels 2, 4, 5 and 7 can't access the page if(in_array($userdata['user_level'], $restricted)){ die('Wrong user level.'); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.