Added the if condition to check if a logged in user exists to all pages that require a logged in user.