Help - Search - Members - Calendar
Full Version: Download protector?
The Planet Forums > General > The Lounge
thrillhaus
Howdy -

I was looking for a download protector so that I could utilize adsense and distribute downloads while displaying the the ads without allowing direct linking.

This is the script I was looking at:

CODE
<?php



///////////////////////////////////////////////

//                                           //

// Download Protector v 1.1                  //

// ----------------------------------------- //

// by Graeme (webmaster@phpscriptcenter.com) //

// http://www.phpscriptcenter.com            //

//                                           //////////////////////////////

// PHP Script CENTER offers no warranties on this script.                //

// The owner/licensee of the script is solely responsible for any        //

// problems caused by installation of the script or use of the script    //

//                                                                       //

// All copyright notices regarding Download Protector, must remain       //

// intact on the scripts and in the HTML for the scripts.                //

//                                                                       //

// (c) Copyright 2001 PHP Script CENTER                                  //

//                                                                       //

// For more info on Download Protector,                                  //

// see http://www.phpscriptcenter.com/downloadprotector.php              //

//                                                                       //

///////////////////////////////////////////////////////////////////////////



$ADMIN[defaulturl] = "http://phpscriptcenter.com";



$okaysites = array("http://phpscriptcenter.com","http://www.phpscriptcenter.com");    



$ADMIN[url_1] = "http://www.phpscriptcenter.com/download.php3?product=";

$ADMIN[url_2] = "http://downloads.com";

$ADMIN[url_3] = "http://downloads.com/new";



//////////////////////////////////////////////////////



$reffer = $HTTP_REFERER;

if($reffer) {

$yes = 0;

while(list($domain, $subarray) = each($okaysites)) {

if (ereg("$reffer",$subarray)) {

$yes = 1;

}

}

$theu = "url"."_"."$site";

if ($ADMIN[$theu] AND $yes == 1) {

header("Location: $ADMIN[$theu]/$file");

} else {

header("Location: $ADMIN[defaulturl]");

}

} else {

header("Location: $ADMIN[defaulturl]");

}



?>


Only problem with this script is that it looks at the entire referring link. Is it possible to just have it look at the domain. I ask this because I wish to parse my download page with the download's name in the URL.

i.e.:

download.php?download=whatever.exe shows a page with the adsense and a link to the download (possibly download begins in x seconds). The link is getdownload.php?site=1&file=whatever.exe which goes to the above script.

Thanks!
thrillhaus
eh?

All I wants to know if it's possible. Then, if yes, what I should look for in order to do it.

Thanks!
klaude
Try putting just domain names in the $okaysites array. The ereg() call is where it actually checks the referrer. Play with that a little. icon_smile.gif
thrillhaus
Nope, doesn't work. Also, upon testing using FireFox, it reveals the download spot, so in reality, it does not do anything.
thrillhaus
Found a brilliant script that performs perfectly!

http://www.hotscripts.com/Detailed/33998.html
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.