Added code to prevent users from accessing certain pages if they are not logged in