add functions: Login, Logout, Register

using session to restore login status, there was a bug, to be fixed