forked from vergnet/site-accueil-insa
72 lines
No EOL
2.1 KiB
PHP
72 lines
No EOL
2.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;
|
|
}
|
|
|
|
echo '<link rel="stylesheet" type="text/css" href="admin.css" />';
|
|
|
|
if($user_exist != 1) {
|
|
if($page != "index") {
|
|
header('Location: index.php');
|
|
}
|
|
} else {
|
|
$content =
|
|
'<a href="index.php"><li class="green">Index</li></a>'
|
|
.'<a href="stats.php"><li class="green">Stats</li></a>';
|
|
|
|
switch ($user['perm']) {
|
|
case 1:
|
|
$content = $content."<a href='ville.php'><li class='yellow'>Com'ville</li></a>";
|
|
break;
|
|
case 2:
|
|
$content = $content
|
|
."<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>"
|
|
.'<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>'
|
|
.'<a href="enigma.php"><li class="red">Enigma</li></a>'
|
|
.'<a href="../matomo" target="_matomo"><li class="red">Matomo</li></a>';
|
|
break;
|
|
}
|
|
|
|
$content = $content.'<a href="deco.php"><li class="white">Se déconnecter</li></a>';
|
|
}
|
|
?>
|
|
|
|
<!-- 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 -->
|
|
|
|
<nav>
|
|
<ul>
|
|
<?php
|
|
if(isset($content)) {
|
|
echo $content;
|
|
} ?>
|
|
</ul>
|
|
</nav>
|