Added a check at the top of the file to see if the user is logged in to be able to see the page.