Author |
Message |
CodeWarrior
Junior WebHelper
Joined: 12 Jun 2002
Posts: 6
|
Posted:
Wed Jun 12, 2002 2:53 am (21 years, 10 months ago) |
|
Here is the original code=
Code: |
<?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]");
}
?>
|
And this is what the read me file says=
1, Open download.php and edit these 3 varibles
$ADMIN[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
$ADMIN[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)
$ADMIN[url_4] = "http://site.com";
$ADMIN[url_5] = "http://site.com";
$ADMIN[url_6] = "http://site.com";
and keep going up a number for as many as you want
2, Upload the script to your website
3, Now just link to the download you want by doing http://yoursite.com/download.php?site=1&file=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
It looks simple but it doesnt seem to work can anyone try it and give me to code after your done |
|
|
|
|
CodeWarrior
Junior WebHelper
Joined: 12 Jun 2002
Posts: 6
|
Posted:
Wed Jun 12, 2002 3:38 am (21 years, 10 months ago) |
|
Or maybe someone knows another script that does the same thing that i can download.? |
|
|
|
|
jayant
Team Member
Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India
|
Posted:
Wed Jun 12, 2002 7:43 am (21 years, 10 months ago) |
|
Here is the solution for the problem:
1) dont give ending / in URLs
2) either have http://yoursite.com as well as http://www.yoursite.com ,.....
or simply don't give "http://" that is just yoursite.com or subdomain.yoursite.com
if you give yoursite.com then *yoursite.com* will match and be a correct referer. that is all subdomain download.yoursite.com, help.yoursite.com etc. while subdomain.yoursite.com with restrict to *subdomain.yoursite.com* . |
________________________________ Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test |
|
|
|
CodeWarrior
Junior WebHelper
Joined: 12 Jun 2002
Posts: 6
|
Posted:
Wed Jun 12, 2002 7:38 pm (21 years, 10 months ago) |
|
Right now i have my download.php file like following=
$ADMIN[defaulturl] = "http://www.kinggamers.com";
$okaysites = array("66.216.30.206","http://kinggamers.com","http://www.kinggamers.com");
$ADMIN[url_1] = "http://www.kinggamers.com/sc/files";
$ADMIN[url_2] = "";
$ADMIN[url_3] = "";
and how i have it now doesnt work it just forwards to http://www.kinggamers.com |
|
|
|
|
CodeWarrior
Junior WebHelper
Joined: 12 Jun 2002
Posts: 6
|
Posted:
Wed Jun 12, 2002 10:32 pm (21 years, 10 months ago) |
|
|
|
|
jayant
Team Member
Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India
|
Posted:
Fri Jun 14, 2002 8:05 am (21 years, 10 months ago) |
|
use
echo $HTTP_REFERER;
to see if it gives the correct referer. some hosts like on F2S it was $HTTP_FORWARDED_FOR
you might be behind a proxy etc. which many times dont give out the referer tags.
you can also try using eregi instead of ereg, that way it will ignore the case. |
________________________________ Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test |
|
|
|
CodeWarrior
Junior WebHelper
Joined: 12 Jun 2002
Posts: 6
|
Posted:
Fri Jun 14, 2002 9:41 pm (21 years, 10 months ago) |
|
can u give me an example because im not good with php. or can u just change the code to what u think would work and just post it up? |
|
|
|
|
CodeWarrior
Junior WebHelper
Joined: 12 Jun 2002
Posts: 6
|
Posted:
Wed Jun 19, 2002 10:15 pm (21 years, 10 months ago) |
|
Does anyone know of a script that does the same thing but actually works?? i want it so it doesnt show the url to a file so people cant link files off my website to theirs. can anyone help me? |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Jun 23, 2002 7:42 am (21 years, 10 months ago) |
|
The URL will always be visible (if it isn't then people can't access the file), but you can stop people from linking to them from other sites. Check out the scripts at Hotscripts.com. |
________________________________
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Jun 23, 2002 7:56 am (21 years, 10 months ago) |
|
Quote: | There is something you can do (similar to the trick we're using for images at 4WebHelp, except it would work for other files), but it requires Apache of course. |
What trick that you are using for 4webhelp images??? |
________________________________
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Jun 23, 2002 7:59 am (21 years, 10 months ago) |
|
Andrew, please don't edit my posts in order to reply to them
Here's the code:
Code: | RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://4webhelp.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.4webhelp.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.4webhelp.net.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://search.atomz.com/.*$ [NC]
RewriteRule .*\.(gif|GIF|jpg|JPG)$ http://www.4webhelp.net/images/404.gif [R] |
|
________________________________
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Jun 23, 2002 8:08 am (21 years, 10 months ago) |
|
Yep. Unless the referrer is one of those, it will display an X, or sometimes this image:
|
________________________________
|
|
|
|
|