login and register function refactoring
save session data
keep session data after registration
search function skeleton