I am trying to create an administration panel on my site. I want to restrict access to people who don't have admin_privilege set to 1 in the database. I am fairly new to PHP and MySQL so I am unsure of where to start or how to fix this issue.
This is in my admin/index.php file.
if ($_SESSION['admin_privilege'] == 1) {
if ($_SESSION['admin_privilege'] == 'Administrator') {
//Do nothing
}
} else {
echo "You don't have permission to access this page.";
}
And this is the error I'm receiving when I go to admin/index.php
Notice: Undefined index: admin_privilege in C:\xampp\htdocs\admin\index.php on line 11
You don't have permission to access this page.
My admin_privileged is set to 1 in the database.