e59-website/html/compte.php
Jan BELLON 686d481963 Update 2 files
- /include/functions.php
- /html/compte.php
2024-03-08 21:14:46 +00:00

93 lines
3.1 KiB
PHP

<?php
require "../include/variables.php";
require "../include/functions.php";
if(isset($_SESSION['userid']) == false) {
header("Location: index.php");
http_response_code(404);
die();
}
if(isset($_POST['delete_account'])) {
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$req = $bdd->prepare("DELETE FROM users WHERE ID = :id");
$req->bindParam(':id', $_SESSION['userid']);
if($req->execute()) {
header("Location: logout.php");
exit();
} else {
die("Erreur SQL");
}
}
?>
<!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="./src/css/style.css">
<style>.body {<?=$theme?>}</style>
<link rel="icon" href="src/img/favicon.ico">
<title><?=$title?></title>
</head>
<body class="body">
<header>
<div class="pancontent">
<div class="athena-container">
<a href="/" class="athena-link">
<img src="./src/img/athena-mono.png" class="athena">
</a>
</div>
<div class="content">
<div>
<div class="main-title">
<div class="title"><?=$header_title?></div>
<div class="subtitle"><?=$header_subtitle?></div>
</div>
</div>
</div>
</div>
</header>
<nav>
<div class="pancontent">
<?php nav($nav);?>
</div>
</nav>
<main>
<div class="content">
<div>
<div>
<form>
<?php
echo "<div><input type='text' name='display_name' value='" . $_SESSION['display_name'] . "' required><div>";
echo "<div><input type='email' name='email' value='" . $_SESSION['email'] . "' required><div>";
?>
</form>
</div>
<div>
<?php
foreach ($themes as $thid => $th) {
echo "<a href='?theme=" . $thid . "'><div style='" $th "'>";
echo "<span style='height: 80px; width: 20px; background-color: var(--text)'></span>";
echo "<span style='height: 80px; width: 20px; background-color: var(--background)'></span>";
echo "<span style='height: 80px; width: 20px; background-color: var(--banner-background)'></span>";
echo "<span style='height: 80px; width: 20px; background-color: var(--buttons)'></span>";
echo "</div></a>";
}
?>
</div>
<div><form action="" method="post"><input type="submit" name="delete_account" value="Supprimer le compte (irréversible)" style="font-size: 1em;"></form></div>
</div>
</div>
</main>
<footer>
<div class="content">
<div>
<div><?=$copyright?></div>
</div>
</div>
</footer>
</body>
</html>