70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
|
<?php
|
|||
|
|
|||
|
require ('../connectionBD.php');
|
|||
|
$mail = null;
|
|||
|
$db = connexionBD();
|
|||
|
init($mail);
|
|||
|
|
|||
|
function init(&$mail){
|
|||
|
session_start();
|
|||
|
|
|||
|
//Si on est pas connecté redirection vers la page de connexion
|
|||
|
if(!isset($_SESSION['mail'])){
|
|||
|
header('Location: ../index.php');
|
|||
|
}
|
|||
|
else{
|
|||
|
$mail = $_SESSION['mail'];
|
|||
|
//Si clic sur le bouton de déconnexion détruire la session et rediriger l'utilisateur
|
|||
|
if(isset($_POST['deco'])){
|
|||
|
session_unset();
|
|||
|
session_destroy();
|
|||
|
header('Location: ../index.php');
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function getPrenom($db, $mail){
|
|||
|
$result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail));
|
|||
|
if($result){
|
|||
|
$row = pg_fetch_array($result);
|
|||
|
$prenom = $row[0];
|
|||
|
return " $prenom";
|
|||
|
}
|
|||
|
return "";
|
|||
|
}
|
|||
|
|
|||
|
?>
|
|||
|
|
|||
|
<!DOCTYPE html>
|
|||
|
<html lang="fr">
|
|||
|
<head>
|
|||
|
<meta charset="UTF-8">
|
|||
|
<link rel="stylesheet" href="tableauBord.css">
|
|||
|
<title>Tableau de bord</title>
|
|||
|
<script src="tableauBord.js"></script>
|
|||
|
</head>
|
|||
|
<body>
|
|||
|
<nav class="menu">
|
|||
|
<a class="menuItem" href="./../inscription.php">Tableau de bord</a>
|
|||
|
<a class="menuItem" href="../inscription.php">Trajets publiés</a>
|
|||
|
<a class="menuItem" href="../inscription.php">Trajets réservés</a>
|
|||
|
<a class="menuItem" href="../inscription.php">Messagerie</a>
|
|||
|
<a class="menuItem" href="../inscription.php">Avis reçus</a>
|
|||
|
<a class="menuItem" href="../inscription.php">Avis laissés</a>
|
|||
|
<a class="menuItem" href="../inscription.php">Profil</a>
|
|||
|
<a id="btnDeco" class="menuItem">Se déconnecter</a>
|
|||
|
<form id="formDeco" method="post" action="tableauBord.php">
|
|||
|
<input type="hidden" value="true" name="deco">
|
|||
|
</form>
|
|||
|
</nav>
|
|||
|
<div id="content">
|
|||
|
<h1>Bonjour<?php
|
|||
|
echo getPrenom($db,$mail);
|
|||
|
?>
|
|||
|
</h1>
|
|||
|
<div id="cotent">
|
|||
|
<img id="imgProfil" src="../wallpaper.jpg">
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|