The best way is to have one file, index.php3, handle everything and set a cookie when the login was ok. Unset the cookie to log out. Your code structer would look something like this.
Check cookie.
No cookie found, display login page, end
Cookie found, display page requested.
I like this system because I can pass a page ID that has the file name stores in a DB then I include the required page in the content. This is great for templates because you have one occurance of a header, footer and/or navigation etc...
We have build websites with 1000+ pages using this system and it works great. Even if someone bookmarks a page and returnes to that page, they log in and then that page is displayed.
Have fun.
Jason Lavigne
Lead Programmer
Big Orbit New Media