For my project I'm using session based access control to handle different type of users, is it secure? is there any other way to do same thing? This is my coding.
// Note : $_SESSION['role']==1 refer to Admin and ['role']==3 refer to staff
session_start();
if(!empty($_SESSION['cur_user'])&&($_SESSION['role']==1) || ($_SESSION['role']==3) )
{
//if user login details is correct .. doing some stuff
?>
<!-- Website Content-->
<?php
}
else{
unset($_SESSION['cur_user']);
session_destroy();
header ("location:login.php");
}
?>