Securing a folder in public_html

I have a music sharing site and I understand that the files on my site are not necessarily secure as they are stored in a subfolder in public_html. I need to secure them in such a way that they still work for anyone in the music player that is in the listen.php page. However, if the user navigates directly to the file, for example http://www.pearlsquirrel.com/mp3/95d246c26a7c003cdac86ead05659b37.m4a... I don't want them to be able to upload the file to protect my users. However, I cannot add the code to this page because it is mp3. Is there a way to add an index to a folder that will allow me to add javascript to this page? I've tried using .htaccess but no luck. If anyone knows how I could solve this problem, that would be greatly appreciated. Thank!

+3


source to share


3 answers


Stu Thompson explains some good results in this post - Protect flash videos from downloads / rights protection , this link might be especially useful for you - Is it possible to protect against downloading videos from a site



+1


source


try with .htaccess:

  • deny directory listing
  • check urlreferrer / remote IP address


But if, depending on how the user plays the file, if there is direct access to the file, it will be difficult to protect it.

+1


source


You can rewrite your music files to a PHP script, check login through session, and output the music file only if the user is logged in.

You can also put a copy of the mp3 that the user is listening with the session id in the name and deletes it after the session becomes invalid. This way, each user has their own URL that will not be active all the time.

0


source







All Articles