e59-website/html/users.php
Jan BELLON 03bd67ca7d Update 4 files
- /html/editpage.php
- /html/journal.php
- /html/upload.php
- /html/users.php
2024-03-07 20:52:48 +00:00

80 lines
2.6 KiB
PHP

<?php
require "../include/variables.php";
require "../include/functions.php";
if($role < 4) {
header("Location: login.php");
http_response_code(404);
die();
}
?>
<!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">
<link rel="icon" href="src/img/favicon.ico">
<title><?=$title?></title>
</head>
<body>
<header>
<div class="pancontent">
<div class="athena-container">
<a href="/">
<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>
<?php
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$req = $bdd->prepare("SELECT display_name, username, email, role FROM users ORDER BY creation_date DESC");
$req->execute();
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
if ($resultat) {
foreach($resultat as $row) {
echo "<div><form action='' method='post'><div>" . $row['display_name'] . "</div><div>" . $row['username'] . "</div><div>" . $row['email'] . "</div><div><select name='role' required>";
foreach($classifications as $id => $nom) {
if($req['role'] == $id) {
echo '<option value="' . $id .'">' . $nom . '</option>';
} else {
echo '<option value="' . $id .'" selected>' . $nom . '</option>';
}
}
echo "</select><input type='submit' value='Mettre à jour'</div></form></div>";
}
}
?>
</div>
</div>
</div>
</main>
<footer>
<div class="content">
<div>
<div><?=$copyright?></div>
</div>
</div>
</footer>
</body>
</html>