Php file protection to prevent downloading problems: users can read files in a folder after passing session verification. However, you do not want to obtain the file directly from the URL path when the user does not pass the verification. How can I set such permissions and programming? (Virtual host) grateful. do not expose files directly. php reads files and outputs them to users. support the ls statement. you can also consider using php file protection to prevent downloading.
Requirements:
After session verification, you can read files in a folder.
However, you do not want to obtain the file directly from the URL path when the user does not pass the verification.
How can I set such permissions and programming? (Virtual host)
Grateful
------ Solution --------------------
Do not directly expose the path of the file. php reads the file and outputs it to the user.
------ Solution --------------------
Supports the ls statement.
Or you can consider using permissions.
------ Solution --------------------
Use rewrite technology htaccess rewrite
Add. htaccess to restrict the access path here
------ Solution --------------------
In this case, add
If (user session verification)
Define ('denglule', true );
Check on the logon page
If (denglule)
Include ('index. php'); // true
Echo 'wrong door, out'; // false
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