The obvious solution would be to simply not display the registration form at all if the user is already logged in. If this is a registration page (its only purpose is to register new accounts), you might add a notice along the lines of "You're already logged in as {name}. If this is not you, please [click here to log out] and you can create a new account."
We'd need further information from you to suggest an actual solution. You'd need to be more specific about what you want to happen; in addition, you haven't shown us any code.