tdphp/td5/index.php

57 lines
2.3 KiB
PHP
Raw Permalink Normal View History

2023-03-22 08:13:04 +01:00
<?php
session_start();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Monsite</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Mon Site</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Accueil</a>
</li>
<li class="nav-item">
<a class="nav-link" href="persos.php">Personnages Historiques</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container m-5">
<?php if (isset($_GET["deconnexion"])) {
echo "<div class='alert alert-success' role='alert'>Vous êtes déconnecté.</div>";
}
?>
<div class="bg-light p-5 rounded">
<?php if (isset($_SESSION["user"])) { ?>
<h1>Bonjour <?= $_SESSION["user"]["username"] ?></h1>
<p class="lead">Vous êtes <strong class="text-danger"><?= $_SESSION["user"]["role"] ?></strong></p>
<a class="btn btn-lg btn-danger" href="deconnexion.php" role="button">Deconnexion &raquo;</a>
<?php } else { ?>
<h1>Vous n'êtes pas connecté.</h1>
<a class="btn btn-lg btn-primary" href="connexion.php" role="button">Connectez vous &raquo;</a>
<?php } ?>
</div>
</div>
<script src="/docs/5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
</body>
</html>