🔧 ajout d'une ébauche de panel admin et de possibilité de modifier les informations du compte.
Modification des header&footer pour afficher le panel admin si connecté en tant qu'ADM
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
<?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'])) {
|
||||
header("Location: /account/profile");
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
|
@@ -15,7 +15,6 @@ if (isset($_COOKIE['userData'])) {
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
} else {
|
||||
echo "Cookie 'userData' non trouvé.";
|
||||
header("Location: /account/login");
|
||||
}
|
||||
?>
|
||||
@@ -44,17 +43,34 @@ if (isset($_COOKIE['userData'])) {
|
||||
<?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>";
|
||||
|
||||
<div class="login-container" style="margin-top: 1rem;">
|
||||
<img src="https://cdn-icons-png.flaticon.com/512/4139/4139948.png" alt="Avatar">
|
||||
<h2>Mettre à jour mes informations</h2>
|
||||
<p>Modifiez les informations de votre profil.</p>
|
||||
<form action="/tools/updater.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="name"><span style="color:red;"><abbr title="Requis">*</abbr></span> Prénom</label>
|
||||
<input type="text" id="name" name="name" value="<?php echo $name ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="family_name"><span style="color:red;"><abbr title="Requis">*</abbr></span> Nom</label>
|
||||
<input type="text" id="family_name" name="family_name" value="<?php echo $familyName ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email"><span style="color:red;"><abbr title="Requis">*</abbr></span> Adresse mail</label>
|
||||
<input type="email" id="email" name="email" value="<?php echo $email ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password"><span style="color:red;"><abbr title="Requis">*</abbr></span> Mot de passe</label>
|
||||
<input type="password" id="password" name="password" required placeholder="••••••••" placeholder=" ">
|
||||
</div>
|
||||
|
||||
?>
|
||||
<form action="/tools/logout.php" method="post">
|
||||
<button type="submit">Déconnexion</button>
|
||||
</form>
|
||||
<button type="submit" class="submit-button"><i class="fas fa-sign-in-alt"></i>
|
||||
Mettre à jour mes informations</i></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
@@ -1,3 +1,16 @@
|
||||
<?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'])) {
|
||||
header("Location: /account/profile");
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
|
@@ -96,7 +96,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
||||
echo "<p class='text'>Mot de passe : " . $password . "</p>";
|
||||
echo "<p class='text'>Mot de passe hashé : " . $hashedPassword . "</p>";
|
||||
echo "<p class='text'>Rôle : " . $role . "</p>";
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
window.location.href = '/account/profile';
|
||||
</script> <?php
|
||||
} else {
|
||||
echo "<p class='text'>Aucun utilisateur n\'a été ajouté.</p>";
|
||||
}
|
||||
@@ -107,14 +110,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
||||
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php');
|
||||
?>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
<?php
|
||||
$newURL = "/account/profile";
|
||||
header("Location: " . $newURL);
|
||||
die();
|
||||
?>
|
||||
</html>
|
Reference in New Issue
Block a user