PHP File Protection, anti-download related issues

Source: Internet
Author: User
PHP File Protection, anti-download issues
Demand:
After the user passes the session verification, the file of a folder can be read.
However, you do not want the user to get the file directly through the URL path without validating it.
How to set such permissions and programming Ah? (Virtual Host)
Appreciate

------Solution--------------------
Do not directly expose the file is really near, by PHP read the file output to the user
------Solution--------------------
Support LS's argument.

Or you might consider using permissions
------Solution--------------------
Using rewriting techniques htaccess rewrite
Add. htaccess here to restrict access paths
------Solution--------------------
To do so, add the login verification
if (user session validation)
Define (' Denglule ', true);

Post-logon page detection
if (denglule)
Include (' index.php '); True
Echo ' Went the wrong door, out '; False
  • 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.