1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <?php
session_start();
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', 'root');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$req = "SELECT fonction FROM membres WHERE id = :id";
$sql = $bdd->prepare($req); // préparation de la requête
$sql->execute( array(
':id' => $_SESSION['id'] // execution de la requête, avec les paramètre nécessaires
) );
$row = $sql->fetch(); // 1 seule ligne -> fetch()
$fonction = $row['fonction']; // récupération de la valeur du champ 'fonction'
?>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>SchoolManager - Menu</title>
<meta name="description" content="Réseau Social Privé"/>
<meta name="keywords" content="navigation, menu, responsive, border, overlay, css transition" />
<?php include("favicon.php"); ?>
<link rel="stylesheet" type="text/css" href="msg.css" />
<link rel="stylesheet" type="text/css" href="actu.css" />
<script type="text/javascript" src="main.js"></script>
<link href='https://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="minichat.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<div id="menu" style="margin-left: 570px"><ul>
<li>
<a class="mainTopNav__item" href="/menu.php">Menu</a>
</li>
<li>
<a class="mainTopNav__item" href="/profil.php?id=<?php echo $_SESSION['id']; ?>&pseudo=<?php echo $_SESSION['pseudo']; ?>">Mes Infos</a>
</li>
</ul>
</div>
<center>
<div id="name">
<div id="user">
<a href="/profil.php?id=<?php echo $_SESSION['id']; ?>&pseudo=<?php echo $_SESSION['pseudo']; ?>"><FONT color="black"><h3><?php echo $_SESSION['pseudo']; ?></h3></FONT></a>
<div id="separating" style="border-top-width: 2px; border-top-style: solid; border-top-color: rgb(190, 190, 190); margin-bottom: 10px;"></div>
<a href="/deconnexion.php"><FONT color="black">Déconnexion</FONT></a>
</div>
</center>
</head>
<body>
<div id="bandepub" style="background-color: #F49B01;">
<center>
<br />
<?php
if ($fonction == 1) {
echo '<p style="text-align: center"><font color="white">Menu :</font></p> <center><div id="separating" style="width: 200px; border-top-width: 2px; border-top-style: solid; border-top-color: rgb(190, 190, 190); margin-bottom: 10px;"></div><a href="/cantine.php" style="color: black; text-decoration: none;">Cantine</a><br /><a href="/absencesreception.php" style="color: black; text-decoration: none;">Absences</a></center>';
} ?>
<div id="bandemsg"></div>
</center>
</section>
<br />
<script>
setInterval('load_messages()', 1000);
function load_messages() {
$('#bandemsg').load('load_messages.php');
}
</script>
</body>
<footer>
<?php include("footer.php"); ?>
</footer>
</html> |
Partager