securing folder access and creating links to documents

I am very new to PHP, but have been trying to research this for several weeks.

For security, can I create user folders named by User_ID (ie. users/user0001/) above the public_html folder, and is there an easy way to call that information using PHP?

So, if I want to allow user0001 to download the file “/users/user0001/123.pdf” how can I script this, bearing in mind that I want to use the same script for multiple User_ID’s?

Hopefully this makes sense! If possible please please give me the absolute ‘idiot proof guide’

…unless there is a better way of securing this information?

Your scripts can access files and such from above the public_html directory, but your users will not be able to , so you will have to keep this in mind when writing your download script. As far as using the script for multiple user IDs, you could simply use a session or $_GET url parameter.

To get started on building a force-download php page, visit: http://www.stemkoski.com/php-script-to-automatically-force-file-download/

Sponsor our Newsletter | Privacy Policy | Terms of Service