Page 1 of 1

Only allow one file to access another

Posted: Mon Oct 12, 2009 2:06 pm
by omniuni
Ah, my first post back!

I've been trying to figure how to do this for several years now, and never managed to get a good solution. Let's say I want to provide an MP3 Player on a website. The MP3 player is flash, and takes the location of the MP3 as an argument. I want a PHP script that will take an MP3 in a protected directory (.htaccess) and deliver it ONLY to that MP3 player. What would be really awesome is if someone could point me to a solution where I would have an easy way to modify the script so that I could also use it to provide file access to people who are logged in to a system of some sort (although I found a script that kind of does that).

Is it possible to do this? Does anyone know where I can look to find out how, or can someone post some sample code?

Basically, I'm working on a website where they want the MP3's to be playable in full, but obviously, they won't want them simple to download; people should buy the CD! (*cough* like I can stop them from launching Audacity and recording the audio_out... *cough*)

Thank you all!

Re: Only allow one file to access another

Posted: Mon Oct 12, 2009 2:19 pm
by requinix
There's no way to differentiate a request from a user from a request from your music player. You can make it harder for a user to forge the right request but not impossible.

What you need is something coded into the player itself: something that you don't have to provide via HTML, like a key or a path. With this secret information it can communicate with your server and request the files to play. Can you modify the Flash app?