site-accueil-insa/admin/script.php
2022-06-14 23:36:26 +02:00

50 lines
No EOL
1.1 KiB
PHP

<?php
include "../script/db.php";
session_start();
if(isset($_SESSION['id'])) {
$req_user = $db->prepare("SELECT pseudo, perm FROM admin WHERE id = ?");
$req_user->execute(array($_SESSION['id']));
$user_exist = $req_user->rowcount();
$user = $req_user->fetch();
} else {
$user_exist = 0;
}
if($user_exist != 1) {
if($page != "index") {
header('Location: index.php');
}
} else {
switch ($user['perm']) {
case 0:
?>
<a href="index.php">Index</a><br>
<a href="stats.php">Stats</a><br>
<a href="deco.php">Se déconnecter</a><br>
<?php
break;
case 1:
?>
<a href="index.php">Index</a><br>
<a href="planning.php">Planning</a><br>
<a href="stats.php">Stats</a><br>
<a href="deco.php">Se déconnecter</a><br>
<?php
break;
case 2:
?>
<a href="index.php">Index</a><br>
<a href="gestion_des_acces.php">Gestion des accès</a><br>
<a href="enigma.php">Enigma</a><br>
<a href="planning.php">Planning</a><br>
<a href="stats.php">Stats</a><br>
<a href="vacances.php">Vacances</a><br>
<a href="deco.php">Se déconnecter</a><br>
<?php
break;
}
}
?>