site-accueil-insa/admin/script.php

72 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2022-06-14 23:36:26 +02:00
<?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;
}
2022-06-15 17:35:34 +02:00
echo '<link rel="stylesheet" type="text/css" href="admin.css" />';
2022-06-14 23:36:26 +02:00
if($user_exist != 1) {
if($page != "index") {
header('Location: index.php');
}
} else {
2022-06-15 17:35:34 +02:00
$content =
2022-06-15 21:19:49 +02:00
'<a href="index.php"><li class="green">Index</li></a>'
.'<a href="stats.php"><li class="green">Stats</li></a>';
2022-06-15 17:35:34 +02:00
2022-06-14 23:36:26 +02:00
switch ($user['perm']) {
case 1:
2022-07-24 19:54:06 +02:00
$content = $content."<a href='ville.php'><li class='yellow'>Com'ville</li></a>";
2022-06-14 23:36:26 +02:00
break;
case 2:
2022-06-15 17:35:34 +02:00
$content = $content
2022-07-24 19:54:06 +02:00
."<a href='ville.php'><li class='yellow'>Com'ville</li></a>"
.'<a href="planning.php"><li class="orange">Planning</li></a>';
break;
case 3:
$content = $content
."<a href='ville.php'><li class='yellow'>Com'ville</li></a>"
2022-06-15 21:19:49 +02:00
.'<a href="planning.php"><li class="orange">Planning</li></a>'
.'<a href="gestion_des_acces.php"><li class="red">Gestion des accès</li></a>'
2022-06-17 16:21:37 +02:00
.'<a href="enigma.php"><li class="red">Enigma</li></a>'
.'<a href="../matomo" target="_matomo"><li class="red">Matomo</li></a>';
2022-06-14 23:36:26 +02:00
break;
}
2022-06-15 17:35:34 +02:00
2022-06-15 21:19:49 +02:00
$content = $content.'<a href="deco.php"><li class="white">Se déconnecter</li></a>';
2022-06-14 23:36:26 +02:00
}
2022-06-15 17:35:34 +02:00
?>
2022-07-17 20:00:38 +02:00
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//etud.insa-toulouse.fr/~accueil_insa/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
2022-06-15 17:35:34 +02:00
<nav>
<ul>
<?php
if(isset($content)) {
echo $content;
} ?>
</ul>
</nav>