Actualiser register.php
This commit is contained in:
14
register.php
14
register.php
@@ -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'; ?>
|
||||
Reference in New Issue
Block a user