From what I understood you have password protection over a list of links to some pdf's on the server, like:
if (check_password())
{
echo '<a href="files/pdf_file_1.pdf">This is the first file</a>';
//and so on
}
else
{
print_login_form();
echo "This site is protected";
}
. If that's not true, don't bother reading further.
The thing you have to do is, as mentioned above, move your files outside your web root and use the script to send headers apropriate to pdf and the contets of the file:
//download.php
if (check_password())
{
if (isset($_GET['file']))
{
$filename = "/absolute/path/to/pdf_folder/".$_GET['file'].".pdf";
header('Content-type: application/pdf');
header("Content-Disposition: attachment; filename=\"$_GET[file].pdf\"");
readfile($filename);
}
else
{
print_all_possible_downloads();
}
}
else
{
print_login_form();
echo "This site is protected";
}
At the last stage, when printing possible downloads urls should look like http://your.server.com/downolad.php?file=filename_without_extension
<a href="http://your.server.com/downolad.php?file=filename_without_extension">One of the files</a>