Prevent direct access to mp3/wav files while allowing a flash player to access them with .htaccess (or PHP)

前端 未结 4 660
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 05:34

How do I prevent direct access/download to mp3/wav files while allowing a flash player to access them with .htaccess (or PHP)? I\'ve been looking for a solution with only pa

4条回答
  •  孤街浪徒
    2020-12-16 06:13

    Since PHP is available, use it to protect the files. Don't have them in them in the web root, but somewhere that is accessible to PHP. Then generate a one-time-use URL like:

    
    

    Then store that unique value in the session/server/db and have another page validate the unique string prior to streaming the file:

    Stream Me
    

    Be sure to expire that unique token after the first use (or maybe after a few times if you are feeling generous). It won't stop the die-hards from capturing the HTTP stream anyway, but it should prevent casual linking.

提交回复
热议问题