write the logic of login page, reg page and logout page