0
I am making a page, using PHP I entered an access level to it. The access levels are user and admin. Just that I want when the access level is admin a button appears and when it is user does not appear the same
<?php
session_start();
if($_SESSION['nivel'] == "usuario" || $_SESSION['nivel'] == "admin")
{
}
if($_SESSION['nivel'] == "admin")
{
echo '<div class="container" >';
echo '<a href="index.html"><img id="back-arrow" src="imagem/back-
arrow.png" alt="voltar"></a>';
echo '</div>';
}else{
header("Location:index.html");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Estuda+</title>
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.4.2/css/all.css"
<link rel="stylesheet" href="css/pato.css">
<link rel="shortcut icon" href="../imagens/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<style>
#sair {
position: absolute;
left: 3%;
margin-left: -35px;
transition-duration: 0.5s;
border-radius: 50%;
}
#sair:hover {
background-color: #428db8;
box-shadow: -5px 5px black;
}
#back-arrow {
position: absolute;
width: 48px;
height: 48px;
left: 15%;
top: 85%;
margin-left: -35px;
transition-duration: 0.5s;
border-radius: 50%;
}
#back-arrow:hover{
background-color: #428db8;
box-shadow: 5px 5px 2px 2px black;
}
</style>
</head>
<body>
<div class="container" >
<a href="logout.php"><img id="sair" src="imagem/exit.png" alt=""></a>
</div >
<nav>
<ul class="menu">
<li>
<a href="#" title="#" class="borda">Ciências exatas <i id="icone"
class="fas fa-arrow-down"></i></a>
<ul>
<li><a href="../site/matematica/matematica.html"
target="_blank">Matemática</a></li>
<li><a href="#" target="_blank">Física</a></li>
<li><a href="#" target="_blank">Química</a></li>
</ul>
</li>
<li><a class="borda" href="#">Ciências biológicas <i class="fas fa-
arrow-down"></i></a>
<ul>
<li><a href="\Celular Gerentes.html"
target="_blank">Biologia</a></li>
</ul>
</li>
<li style="background:none; position: relative;">
<img src="../imagens/logo%20estudamais.png" width="200px"
class="top" >
</li>
<li>
<a href="#" class="borda" title="Importação de folhas de
estilo">Linguagens <i class="fas fa-arrow-down"></i></a>
<ul>
<li><a href="#" target="_blank">Gramática</a></li>
<li><a href="#l" target="_blank">Redação</a></li>
<li><a href="#" target="_blank">Literatura</a></li>
<li><a href="#" target="_blank">Inglês</a></li>
<li><a href="#" target="_blank">Espanhol</a></li>
</ul>
</li>
<li>
<a href="#" class="borda" title="Fale conosco">Ciências humanas <i
class="fas fa-arrow-down"></i></a>
<ul>
<li><a href="#l" target="_blank">Geografia</a></li>
<li><a href="#" target="_blank">História</a></li>
<li><a href="#" target="_blank">Sociologia</a></li>
<li><a href="#" target="_blank">Filosofia</a></li>
</ul>
</li>
</ul>
</nav>
<div id="banner" style="width:100%" style="height:100%"><img
src="../imagens/banner-escola.jpg" style="width:100%" style="height:100%">
</div>
</body>
</html>
I want when the access level is admin the following element appears:
<div>
<a href="index.html">
<img id="back-arrow" src="imagem/back-arrow.png" alt="voltar">
</a>
</div>
But haven’t you already done this in your code? Are you making a mistake?
– user130117
And why are you making the button appear before HTML?
– Bacco
Yes, but appear where? in what place inside your HTML?
– user76097