if you're afraid that passwords/usernames can be captured, then answer is simple: use ssl.
about preventing unauthorized access to files via http:
i do it this way: i keep files outside of server's directories and only way to retrieve them from cient's side is to call PHP.
for example if you use cookies for athentication, u do somethink like that:
Code:
if(!isset($_COOKIE['some_auth_cookie'])){
die();
}
if($_COOKIE['some_auth_cookie'] != $expected_value){
die();
}
$filename_with_path = '/path/to/your/files/' . $_GET['file'];
if(!file_exists($filename_with_path)){
die();
}
header('Content-type: ' . mime_content_type($filename_with_path));
header('Content-Disposition: attachment; filename="'. $_GET['file'] .'"');
readfile($filename_with_path);
And then instead of linking files like you always do, you direct users to say example.com/download-script.php?file=some-file.pdf
this is not exact code u can use but gives u idea how to aproach this