This function is for a site which as a whole requires the user to be logged in.
So you could do something like
With the die in the function you assure, that the rest of the code is not executed - it's the most easiest way I think~
echo the real content of the site, just for logged-in users;
If you just want to leave out some things for not logged in users or sth. like that, you can just use the good old if
if ($_SESSION['logged_in']) echo edit-link;
echo "next entry";