SAE_web/account/profile/index.php

62 lines
2.1 KiB
PHP
Raw Normal View History

<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
session_start();
if (isset($_COOKIE['userData'])) {
$userDataEncoded = $_COOKIE['userData'];
$userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif
$email = $userData['email'];
$name = $userData['name'];
$familyName = $userData['familyName'];
$role = $userData['role'];
} else {
echo "Cookie 'userData' non trouvé.";
header("Location: /account/login");
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../../styles/main.css" />
<link rel="stylesheet" href="../../styles/header.css" />
<link rel="stylesheet" href="../../styles/footer.css" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
<link rel="icon" type="image/png" sizes="32x32"
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
<script src="https://kit.fontawesome.com/f16a36bad3.js"
crossorigin="anonymous">if (!document.cookie.includes("userData")) { window.location.href = '/account/login'; }</script>
<title>Mon profil | Jeux Olympiques - Paris 2024</title>
</head>
<body>
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
<h1>Mon profil :</h1>
<?php
echo "<p class='text'>Email : " . $userData['email'] . "</p>";
echo "<p class='text'>Prénom : " . $userData['name'] . "</p>";
echo "<p class='text'>Nom : " . $userData['familyName'] . "</p>";
echo "<p class='text'>Rôle : " . $userData['role'] . "</p>";
?>
<form action="/tools/logout.php" method="post">
<button type="submit">Déconnexion</button>
</form>
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
</body>
</html>