Replace var loggedIn by checking ID != 0