register form validation, move DB logic in Database class