Charl
11-17-2002, 10:13 PM
I am trying to get this script to work on my site so i can prevent people hogging my bandwith.
I managed to get it redirecting to the default html, but i cant seem to download my own files yet.
Script url
http://www.CGI-Scripting.com
The script:
$defaulturl = "http://www.ivdrip.com/charlatanz/";
@okaysites = ("http://www.ivdrip.com/charlatanz/", "http://www.ivdrip.com/charlatanz/");
$url_1 = "http://www.ivdrip.com/charlatanz/";
####################### DO NOT EDIT BELOW THIS LINE ######################
@querypairs = split(/&/, $ENV{'QUERY_STRING'});
foreach $querypair (@querypairs) {
($queryname, $queryvalue) = split(/=/, $querypair);
$queryvalue =~ tr/+/ /;
$queryvalue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$queryvalue =~ s/<([^>]|\n)*>//g;
if ($QUERY{$queryname}) { $QUERY{$queryname} = $QUERY{$queryname}.",".$queryvalue; }
else { $QUERY{$queryname} = $queryvalue; }
}
$reffer = $ENV{'HTTP_REFERER'};
$yes = 0;
foreach $domain (@okaysites) {
if ($reffer =~ /$domain/) {
$yes = 1;
}
}
$theu = "url"."_"."$QUERY{'site'}";
if ($$theu && $yes == 1) {
print "Location: $$theu/$QUERY{'filename'}\n\n";
} else {
print "Location: $defaulturl\n\n";
}
exit;
The instructions:
1, Open downloader.cgi and edit these 3 varibles
$defaulturl = It will redirect people to this url if they are trying to link to your downloads off there site
@okaysites = sites which can download files off your site
$url_1 = A location to a download folder with some downloads in it
(to add more download locations just put on a new line in the script)
$url_4 = "http://site.com";
$url_5 = "http://site.com";
$url_6 = "http://site.com";
and keep going up a number for as many as you want
2, Upload the script to your cgi-bin and chmod it to 755
3, Now just link to the download you want by doing http://yoursite.com/cgi-bin/downloader.cgi?site=1&filename=thefile.zip
On that link it has ( site=1 ) that means it calls the download location ( $url_1 )
just change it to what you want so it calls the correct folder
I managed to get it redirecting to the default html, but i cant seem to download my own files yet.
Script url
http://www.CGI-Scripting.com
The script:
$defaulturl = "http://www.ivdrip.com/charlatanz/";
@okaysites = ("http://www.ivdrip.com/charlatanz/", "http://www.ivdrip.com/charlatanz/");
$url_1 = "http://www.ivdrip.com/charlatanz/";
####################### DO NOT EDIT BELOW THIS LINE ######################
@querypairs = split(/&/, $ENV{'QUERY_STRING'});
foreach $querypair (@querypairs) {
($queryname, $queryvalue) = split(/=/, $querypair);
$queryvalue =~ tr/+/ /;
$queryvalue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$queryvalue =~ s/<([^>]|\n)*>//g;
if ($QUERY{$queryname}) { $QUERY{$queryname} = $QUERY{$queryname}.",".$queryvalue; }
else { $QUERY{$queryname} = $queryvalue; }
}
$reffer = $ENV{'HTTP_REFERER'};
$yes = 0;
foreach $domain (@okaysites) {
if ($reffer =~ /$domain/) {
$yes = 1;
}
}
$theu = "url"."_"."$QUERY{'site'}";
if ($$theu && $yes == 1) {
print "Location: $$theu/$QUERY{'filename'}\n\n";
} else {
print "Location: $defaulturl\n\n";
}
exit;
The instructions:
1, Open downloader.cgi and edit these 3 varibles
$defaulturl = It will redirect people to this url if they are trying to link to your downloads off there site
@okaysites = sites which can download files off your site
$url_1 = A location to a download folder with some downloads in it
(to add more download locations just put on a new line in the script)
$url_4 = "http://site.com";
$url_5 = "http://site.com";
$url_6 = "http://site.com";
and keep going up a number for as many as you want
2, Upload the script to your cgi-bin and chmod it to 755
3, Now just link to the download you want by doing http://yoursite.com/cgi-bin/downloader.cgi?site=1&filename=thefile.zip
On that link it has ( site=1 ) that means it calls the download location ( $url_1 )
just change it to what you want so it calls the correct folder