4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 I need help with something called Download Protector
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
CodeWarrior
Junior WebHelper
Junior WebHelper


Joined: 12 Jun 2002
Posts: 6

PostPosted: Wed Jun 12, 2002 2:53 am (15 years, 6 months ago) Reply with QuoteBack to Top

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 Question
OfflineView User's ProfileFind all posts by CodeWarriorSend Personal MessageVisit Poster's Website
CodeWarrior
Junior WebHelper
Junior WebHelper


Joined: 12 Jun 2002
Posts: 6

PostPosted: Wed Jun 12, 2002 3:38 am (15 years, 6 months ago) Reply with QuoteBack to Top

Or maybe someone knows another script that does the same thing that i can download.?
OfflineView User's ProfileFind all posts by CodeWarriorSend Personal MessageVisit Poster's Website
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Wed Jun 12, 2002 7:43 am (15 years, 6 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
CodeWarrior
Junior WebHelper
Junior WebHelper


Joined: 12 Jun 2002
Posts: 6

PostPosted: Wed Jun 12, 2002 7:38 pm (15 years, 6 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by CodeWarriorSend Personal MessageVisit Poster's Website
CodeWarrior
Junior WebHelper
Junior WebHelper


Joined: 12 Jun 2002
Posts: 6

PostPosted: Wed Jun 12, 2002 10:32 pm (15 years, 6 months ago) Reply with QuoteBack to Top

Im using the following code for the link thats on my website Arrow

http://www.kinggamers.com/download.php?site=1&file=filename.zip
OfflineView User's ProfileFind all posts by CodeWarriorSend Personal MessageVisit Poster's Website
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Fri Jun 14, 2002 8:05 am (15 years, 6 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
CodeWarrior
Junior WebHelper
Junior WebHelper


Joined: 12 Jun 2002
Posts: 6

PostPosted: Fri Jun 14, 2002 9:41 pm (15 years, 6 months ago) Reply with QuoteBack to Top

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?
OfflineView User's ProfileFind all posts by CodeWarriorSend Personal MessageVisit Poster's Website
CodeWarrior
Junior WebHelper
Junior WebHelper


Joined: 12 Jun 2002
Posts: 6

PostPosted: Wed Jun 19, 2002 10:15 pm (15 years, 5 months ago) Reply with QuoteBack to Top

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?
OfflineView User's ProfileFind all posts by CodeWarriorSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun Jun 23, 2002 7:42 am (15 years, 5 months ago) Reply with QuoteBack to Top

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.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun Jun 23, 2002 7:56 am (15 years, 5 months ago) Reply with QuoteBack to Top

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???

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun Jun 23, 2002 7:59 am (15 years, 5 months ago) Reply with QuoteBack to Top

Andrew, please don't edit my posts in order to reply to them Smile

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]

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun Jun 23, 2002 8:08 am (15 years, 5 months ago) Reply with QuoteBack to Top

Yep. Unless the referrer is one of those, it will display an X, or sometimes this image:

Image

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.067383 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme