Register
Registration successful! You can now login.
prepare("SELECT id FROM users WHERE username = ?"); $stmt->execute([$username]); if ($stmt->fetch()) { $errors[] = 'Username already taken.'; } else { $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = $pdo->prepare("INSERT INTO users (username, password, role) VALUES (?, ?, ?)"); // For now, all new users are 'regular'. The first admin will be created manually. $stmt->execute([$username, $hashed_password, 'regular']); $success = true; } } catch (PDOException $e) { $errors[] = "Database error: " . $e->getMessage(); } } } ?>
Registration successful! You can now login.