prepare("SELECT id FROM users WHERE username = ? OR email = ?"); $stmt->execute([$username, $email]); if ($stmt->fetch()) { $error = "Username or email already exists."; } else { $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = $pdo->prepare("INSERT INTO users (username, email, password, role) VALUES (?, ?, ?, 'user')"); if ($stmt->execute([$username, $email, $hashed_password])) { $success = "Registration successful! You can now login."; } else { $error = "Registration failed. Please try again."; } } } } else { $error = "Please fill in all fields."; } } ?>
Create your account to get started
Already have an account? Login here
← Back to Site