Greetings,
First of all, i'd like to apologize for my poor english, which is not my main lenguage, i hope you'll understand the following anyway 🙂
I have to make a protected downloads manager, this is what it means :
- Only the users authorized will be able to download the file.
It may be for an application where you have to pay to download something, or just because i want some users (members for example) to download and not others.
All authorization acesses are already done, so i've come to the point where the user is known to be an authorized user, and will click on the link for downloading the file, and in next page i want to make this user download the file automatically preventing anyone else (not allowed) to do so.
Every file that can be downloaded is kept in a protected directory only readable by the server.
I have thought of some solutions but i didn't find the optimal one yet
1) Copy the file to a non protected directory with a random name and make the user download this new file
Problems :
- It's not that much secure, as you could still download the file if you find a way to know the random name that has been set. (or test everything in the free directory)
- i don't know how to delete the file after it has been downloaded or if the download has failed without having the user to click on a button like "i have finished downloading"
To bypass the first problem, i thought of allowing the download only if noone else is downloading this file already, but again i don't know how to do it and it doesn't solve the second problem
2) Using a client_sided program (like a java function or a "beurk" activeX control) that the user has to download (or that will install automatically on agreement) to be able to download on the website.
This last option seems to be the best one, but in fact i have no knowledge of this type of programming, so if anyone knows how it works, or how it could work i could start working on it with at least some basis. (i understand this is not related directly to php programming but as it would be included in a php code i hope someone can help)
That's all so if anyone has a solution or can help with the ones above i have already thought of it would be great !
Please understand that solutions known as "anti-leech" where url is just hided to the user is NOT an acceptable solution for me, it's only poor security level and will not prevent "intelligent" users to download the file...
Thank you
EnderW