similar script that includes a logout function