Iv'e done what you're looking to do and this is how I did it...
I made a header.inc file and put all the common HTML in there and some PHP. Part of the PHP I put in there was this...
<?php
if(!session_is_registered("ID") && $secure) {
// print out the login form
exit;
}
// carry on with the rest here.
?>
then on every page I made that I wanted to be secure (must have entered a password first) I did this...
<?php
$secure = 1;
include 'header.inc';
// code for the page here
?>
What I did there was made the value of $secure true. So in header.inc it's saying id the session ISN'T registered to ID (ID is what I used. Sub it for the value you're using) and the value of $secure is true, then print out the login form and then exit the rest of the script. If I didn't want the page to be secure, I'd simply leave out the $secure = 1; bit.
Hope this helps.
Regards, Stezz.