Hi,
I have admin panel where I have one admin ( super admin ) which has full permission to all section of the website, database queries .. etc.
Now I want to create another admin (member) whit less permissions and to have access to few pages. I don't know how to start this. Can someone point me. This is what I currently use for login
$query = mysqli_query($con, "SELECT * FROM users WHERE username='".addSlashes($username)."' AND password='".addSlashes($password)."'");
$res = mysqli_num_rows($query);
if ($res == 1) {
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$_SESSION['userobj'] = mysqli_fetch_assoc($query);
header('Location: main.php');
exit;
} else {
echo '<a href="index.php">Wrong password/usrname. Please try again</a> ';
}
My table for users has row 'userType' where I hold '5' for superadmin and '1' for another admin. So I guess somehow I will check for userType when is login but then?