the part of register login logout and some fns