How to prohibit non-member users from accessing videos/images

Source: Internet
Author: User
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);
}
?>
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.