Working log out script using function // Working login/logout check