Actualiser register.php

This commit is contained in:
2026-05-22 11:57:02 +00:00
parent cca989a9f1
commit e7b8d8515c

View File

@@ -18,7 +18,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$hash = password_hash($password, PASSWORD_DEFAULT);
$users[$username] = [
'password' => $hash,
'role' => ($username === 'admin') ? 'Admin' : 'User'
'role' => 'User'
];
file_put_contents($usersFile, json_encode($users, JSON_PRETTY_PRINT));
header("Location: login.php?registered=1");
@@ -29,7 +29,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
include 'include/header.php';
?>
<div class="form-box">
<div class="form-box">
<h2>Créer un compte</h2>
<?php if ($message): ?>
<p class="form-error"><?php echo htmlspecialchars($message); ?></p>
@@ -47,13 +47,13 @@ include 'include/header.php';
<button type="submit">S'inscrire</button>
</form>
<p class="form-link">Déjà un compte ? <a href="login.php">Se connecter</a></p>
</div>
</div>
<script>
function togglePassword() {
<script>
function togglePassword() {
const input = document.getElementById('password');
input.type = input.type === 'password' ? 'text' : 'password';
}
</script>
}
</script>
<?php include 'include/footer.php'; ?>