Welcome Guest, Not a member yet? Register   Sign In
How can I prevent download of my audio files?
#1

[eluser]fivefinger-bd[/eluser]
Solved
#2

[eluser]HomersBrain[/eluser]
Put your files outside of the web root. This is what I do. Have a look at this thread, where I asked a similar question.

http://ellislab.com/forums/viewthread/115804/
#3

[eluser]InsiteFX[/eluser]
There really is no way to stop some one from getting your audio and video files!

And if your want proof put it up with a link and I will get it!

I have an Audio application and guess what it records WHAT you HEAR! even .rm and .ram real audio files

So you can stop a casual user but not everyone!

InsiteFX
#4

[eluser]fivefinger-bd[/eluser]
@InsiteFX thanks for your reply. Ya you are right i can't stop everyone. But I just want to prevent audio files download directly using Download accelators.
#5

[eluser]fivefinger-bd[/eluser]
@Homers Brain thank you for the link. I think outside webroot would be a good solution. I'll test it and let you know.
#6

[eluser]InsiteFX[/eluser]
Some thing like this maybe:
Code:
$path = "home/musicdir/";  // outside of root directory! Above index.php
$file = $_GET['file'];

if( (!$file ) or (!file_exists( $path . $file ) ) ) {
die( "File wasnt set or it doesn't exist" );
}

$ref = $_SERVER['HTTP_REFERER'];
$domains = array(
'http://example.com/',
'http://www.example.com/',
'http://music.example.com/',
'http://etc.example.com/');

$length = array();

foreach($domains as $i => $url){
$length[$i] = strlen($url);
}
$error = false;

foreach($domains as $i => $url){
if(substr($ref,0,$length[$i])!= $url){
$error = true;
}
}
if($error or!isset($ref) or $ref == ''){
die('No Stealing Music!');
}

header("Content-Disposition: attachment; filename=\"$file\"");
header("Content-type: audio/mpeg"); //mp3 contenttype
header("Cache-Control: no-cache, must-revalidate"); //The page must not be stored in the cache
header("Expires: Mon, 01 Jan 2000 00:00:00 GMT");
readfile( $path . $file );

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB