Ok...this question will have most of you saying "Why the heck would you do it like that, that is retarded."...but here it goes.
All the data on my website(videos, images, audio...) is stored in a mysql database. As of right now all images stream directly from the database and the videos open as follows:
Due to the fact that I have yet to find an efficient way of streaming from a database it currently dumps the data to a temporary file then displays the video and then deletes it.(in order to protect my content I believe this to be at least 1 extra step in that the video can only be viewed via my website and if someone were to try to download it they most likely would not be able to as it only resides there long enough for the player to grab the file.The part im having trouble with is the deleting part... The script does as follows:
dumps data into a file
outputs the site displaying the movie
executes a script(using this line:
exec("php deleteTempVideo.php filename=$tempName > /dev/null &");
) dumping the output to something is required so that the main script can continue on. otherwise the user would have to wait 5 seconds and then the video would already have been deleted.
The script at the end does the following:
sleeps for 5 seconds
unlinks the file(I also tried executing an rm command, same result)
(it is my understanding from other projects in php that when using the unlink command it does not interfere with current downloads but prevents further downloads and permanently removes the file once the current downloads complete. Please correct me if im wrong)
So im wondering where my goof may have been...what sort of anomoly can cause the file to be deleted and then be recovered or recreated soon thereafter? (the site is currently not available to anyone but me, so its not just a coincidence)
If you have a better suggestion on how to protect my videos feel free to mention it here. All movies added are converted to flv format and displayed in a flash player, so keep that in mind when offering advice. An ultimate solution to my problem would be if I could use a php script to supply the flv file, but all attempts at that have failed...if I could do that I could have the main script insert a unique key into a db table and then the download script can find and remove that key, if it found it it would send the movie, otherwise the person is trying to download it from some other page, or theyre trying to use the src in the html code to grab it.