Greetings,
I am making a web portal that uses username and password to login but also has different levels of user permissions, i figured the easiest way to ensure pages are only viewed by users that are logged in and of the right permission is to use $Session vars to store 2 variables:
$SESSION['logged_on'] =[true][false]
$_SESSION['perm']=[user][exec][admin]
my question is:
if i enclude the blow code in each page to ensure user is logged in and has the right permissions, is it secure.
code:
<?PHP
session_start();
if ($_SESSION['logged_on']==true && $_SESSION['perm']=='admin')
{
//page content only viewable to admin class users
}
?>
is this system of user tracking and autorization secure, ie cant easily be tampered with to allow a 'user' level user from accessing an admin only section.
thank you in advance
ps the session vars are created after login through validation