First of all, I'm completely new at this so be patient.
So there are different roles in my database like admin
and saf
and if the person logged in is an admin I want them to see everything but if the person logged in is saf I just want them to see the Dashboard
andSAF
.
If you need any other code I can provide it but I think this is enough??
<?php
session_start();
$ligaBD=mysqli_connect("localhost","root","","pap");
if (!isset($_SESSION['loggedin'])) {
header('Location: login.html');
exit();
}
if (!isset($_SESSION['role']) || ($_SESSION['role'] != 'admin')) {
?>
<ul class="nav navbar-nav">
<li class="active"><a href="admin.php">Dashboard</a></li>
<li><a href="biblioteca.php">Biblioteca</a></li>
<li><a href="conselhoadmin.php">Conselho Administrativo</a></li>
<li><a href="saf.php">SAF</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Bem-vindo, admin <?=$_SESSION['name']?></a></li>
<li>
<a href="https:a"><img src="./images/mail.png" alt="la" height="13" width="20" /></a>
</li>
<li><a href="./logout.php">Logout</a></li>
</ul>
<?php
}else if (!isset($_SESSION['role']) || ($_SESSION['role'] != 'saf')) {
?>
<ul class="nav navbar-nav">
<li class="active"><a href="admin.php">Dashboard</a></li>
<li><a href="saf.php">SAF</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Bem-vindo, saf @login</a></li>
<li>
<a href="https:a/"><img src="./images/mail.png" alt="la" height="13" width="20" /></a>
</li>
<li><a href="./login.html">Logout</a></li>
</ul>
<?php
mysqli_close($ligaBD);
?>
What happens to me with this code is that when I log-in as a SAF user I can see the admin features anyway.
I'd be really appreciated if you could help me. Thank you