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 Link to comment https://forums.phpfreaks.com/topic/212575-user-login/ 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. Link to comment https://forums.phpfreaks.com/topic/212575-user-login/#findComment-1107415 Share on other sites More sharing options...
richardsanchez@hotmail Posted September 5, 2010 Author Share Posted September 5, 2010 Thx it works! Link to comment https://forums.phpfreaks.com/topic/212575-user-login/#findComment-1107419 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.'); } Link to comment https://forums.phpfreaks.com/topic/212575-user-login/#findComment-1107428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.