For my sites, I use sessions and at the top of each page, I first do the normal session_start() and then:
if(!isset($_SESSION['user'])) header("Location: http://mysite.com/login.php?err=login");
This just redirects the user to the login page if they're not logged in and the login page catches the error that they're not logged in, thus displaying a message like "You must be logged in". This method prevents having to if/else every page. You could even just put this session info into a separate PHP page and make it required at the top of every page that needs a login.