Added pagetemplate to index.php & added a check to see if user was logged in