I have files in folders placed above the web public_html root and wish to echo out hashed links to customers whom have purchased products (digital downloads on an eCommerce store).
The account area page is .php and of course customers will access this page using their login/password and have access to view/download only their purchased products which are set to be displayed by getting the orders from the database using function call and echo'ing table row information on the page. The page is restricted access via authenticated customer(client_id) login/password.
My files url paths are written in MySQL database so should be accessible on echo, but I want to hash the links so customers cannot simply share direct url's on the web (as they do... pirates arrahhh!).
Am I ok placing said files simply above the root, or is it best practice to hash those links for added protection to avoid SQL injection as well... and if so, what code do I need to implement to protect things?
What I'm ultimately looking to do is is protect the files server side and display a hashed link to those and only those customers that have purchased a/the product. But, I'm not sure (how to) what best protects me, my files and the customers investment...?
Thanks!
What code can I use to distribute/print files securely to users, using PHP? I'm stuck for an answer.