admin管理员组

文章数量:1278795

My admin panel on my nav bar only shows to accounts with the username 'admin' as the moment, I would like it to search my USERS database and only show the link to userswith a user_level of 1.

My DB connection file is called dbh.inc.php My functions are called functions.php

I know what I need to do, but no idea how to do it. I need it to echo the nav bar link to users that are in the USERS table (in my database 'dbproject01') with a user level of 1. Does a function need to be created or something? I get the feeling its an easy fix but it's relatively new to me and I'm stuck.

Here is my code in the nav bar atm

if ($_SESSION['useruid'] == 'admin'){
                echo "<li class='nav-item active'>
                <a class='nav-link' href='adminpanel.php'>Admin Panel<span class='sr-only'>(current)</span></a>
                </li>";
              }

Apologise if you need more information or code to help me solve it, not sure which parts I should be posting.

本文标签: In PHP how do I make my navigation bar show certain links to admins only