Fixed database connection. Added register, login functions.