I have my login script in a file called login.php, it checks to see if there is a username and password stored in the current session, if there is, it collects some information, and continues the page.
If there is no username or password present, it dies and shows a form asking for the username and password.
I just
include ("./login.php");
in every page that I want password protected.
After rereading your question, I'm not sure this is what you are asking for. By documents, do you mean like a pdf file available for download?