So what I am trying to do is so that different groups have different permissions that will allow them to look at different things. I have set it up so the table groups has multiple columns, the first 2 being groupid
and groupname
, then the rest are the permissions, either 1 as enabled or 0 as disabled.
<?php
ob_start();
session_start();
require_once 'dbconnect.php';
$res=mysql_query("SELECT * FROM users WHERE userId=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);
$sql=mysql_query("SELECT * FROM groups WHERE groupid=".$userRow['usergroup']);
$groupRow=mysql_fetch_array($sql);
?>
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li><a><i class="fa fa-home"></i> Home <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="home.php">Dashboard</a></li>
<?php if ($groupRow['Test'] == "1") { echo '<li><a href="index2.html">Dashboard2</a></li>'; } ?>
<li><a href="index3.html">Dashboard3</a></li>
</ul>
</li>
</ul>
</div>
<div class="menu_section">
<h3>Live On</h3>
<ul class="nav side-menu">
<li><a><i class="fa fa-bug"></i> Additional Pages <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="e_commerce.html">E-commerce</a></li>
<li><a href="projects.html">Projects</a></li>
<li><a href="project_detail.html">Project Detail</a></li>
<li><a href="contacts.html">Contacts</a></li>
<li><a href="profile.html">Profile</a></li>
</ul>
</li>
</ul>
</div>
</div>
Any suggestions would be great!
Thanks,
cNTr1nity
P.S DBConnect
is just a PHP file that connects the other PHP files to the MySQL database.