prepare("SELECT * FROM users WHERE username = ?"); $stmt->execute([$username]); if ($stmt->fetch()) { $error = 'Username already exists.'; } else { $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = db()->prepare("INSERT INTO users (username, password) VALUES (?, ?)"); if ($stmt->execute([$username, $hashed_password])) { $success = 'Registration successful! You can now login.'; } else { $error = 'An error occurred. Please try again.'; } } } } ?> Register

Register

Login