if/else statement for logout

trying to fix incorrect redirect on logout that sometimes sent the user
to the incorrect logout page