How do I prohibit non-member users from accessing videos/images?
One that is easy to think of:
The resource files are placed outside the public directory, and all access to these resources is through a unified portal, such as:
Http://xxx/file.php?video.mp3
Does this cause a lot of pressure on the server?
Is there a better way?
Please give me a lot of advice!
------to solve the idea----------------------
Files are scrambled when they are saved, garbled or MD5.
In the database to save the user id-the original file name-garbled file name of the corresponding relationship, when the original file name, query to garbled, and then provide the download, the download name is set to a formerly known can
------to solve the idea----------------------
Unless you can make the Web server know your members, otherwise you can only do so, efficiency problems I have not tested, with ReadFile should be possible, as long as it is not the kind of first read to the memory before writing to the output stream. You think so, HTTP access to files, as well as the first through a layer of Web servers, loss is unavoidable.
------to solve the idea----------------------
Use PHP to read files, files on non-web can read the records, and then use PHP to output, in the PHP control rights.
For example, the website's catalogue is/home/www/
If (the judgment is restricted) {
$file = '/home/file/aaa.jpg ';
Echo file_get_contents ($file);
}
?>