added login functions and basic session functionality