Prevent access by access level
I have set up a login system that has 3 access levels: admin, level1 and level2. The access levels are stored in a session, MM_UserGroup. I need to protect some pages from being opened by typing in their URL direct - ie they should only be able to be opened if the user is logged in under the usergroup 'admin'. Can't seem to work out the code to do this - it's probably very simple. Something like
session_start();
if (!isset($_SESSION['MM_UserGroup']=='admin'))
{
header ("Location: login.php");
}
ie if the session is not opened by an admin level user then redirect to the login page, otherwise continue to open the page.
