|
|
|
|
![]() ![]() |
![]() Group: Members
Posts: 17 Joined: 15-July 06 Member No.: 26,645 |
Post
#1
Aug 19 2006, 04:56 PM
Check Referrer Using Php To Prevent People Linking To Your Downloads From Other Sites Ever find that found some people are listing items, images and tuts and linking directly to the download url (those that are like my photoshop tutorial.php?id=0), which is a .php to count the number of downloads. To prevent this, you can add a piece of code to the download pages that checks which page referred them to the download page: if it's my domain, it downloads the file normally, if it's not, it will redirect to my home page instead. Important: Not all browsers log referrers, so this won't work depending on the browser the visitor uses and this method can be also bypassed, but it will work for for the major part of visitors. CODE <?php $yoursite = "yoursite.com"; //Your site url without http:// $yoursite2 = "www.yoursite.com"; //Type your domain with www. this time $referer = $_SERVER['HTTP_REFERER']; //Check if browser sends referrer url or not if ($referer == "") { //If not, set referrer as your domain $domain = $yoursite; } else { $domain = parse_url($referer); //If yes, parse referrer } if($domain['host'] == $yoursite || $domain['host'] == $yoursite2) { //Run your dowloading code here normally } else { //The referrer is not your site, we redirect to your home page header("Location: http://yoursite.com"); exit(); //Stop running the script } ?> Hope some one finds this usefull!! [note=electriic ink] P0T33n, in the future please ensure that your topic titles and descriptions are as descriptive as possible and that you put all your code in [-CODE-] tags. Thank you. [/note] This post has been edited by BuffaloHELP: Aug 21 2006, 05:05 AM |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED]
Posts: 2,310 Joined: 5-November 05 From: That one place over there... Member No.: 13,830 myCENT:24.66 |
Post
#2
Aug 19 2006, 06:06 PM
That is pretty useful I might have to try it sometime. Hopefully I can adjust it to work on all browsers and make it more secure. I would post a comment on the page saying that those who have reached the page from the wrong area can visit the site that way people know the link they got wasn't from the creator of the download or whatever. I can use this for my download system. Nice tutorial.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Post
#3
Aug 20 2006, 07:41 AM
Referals can be changed, which means that this sometimes doesn't work.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 992 Joined: 11-July 04 From: NL Member No.: 75 |
Post
#4
Aug 20 2006, 01:54 PM
This is a nice and usefull script, thanks for sharing it. Leeching is a pretty big problem nowadays seeing every website 'hotlinks like hell' while traffic is very important seeing content can be found everywhere nowadays.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 821 Joined: 6-March 05 Member No.: 4,202 |
Post
#5
Aug 21 2006, 09:33 AM
Nice tutorial. Iīll definitely bookmark it, maybe itīll be useful in the near future. Thanks.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
![]() ![]() ![]() ![]() Group: Members
Posts: 52 Joined: 25-August 07 Member No.: 48,808 |
Post
#7
Sep 10 2007, 06:27 AM
What is the file that I want to put on the server is hosted on a different webserver. Can it check referers for that too?
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 5,876 Joined: 21-September 07 Member No.: 50,369 |
Post
#8
May 3 2008, 02:21 PM
Bad script,very bad. If I put in my reffer : "> ,then this site with this script is vulnerable to XSS -reply by Number.49 |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED]
Posts: 786 Joined: 13-April 07 From: mreža Member No.: 41,558 |
Post
#9
Jun 13 2008, 08:37 PM
Well, this is useful script for web statistics but not for the prevention of unwanted download. So you should check it it may be as starting point for some other more secure scripts. But as this script is very easily defeated it is not very secure. So be careful when imposing this script to your site. And another thing I personally never use open source scripts that are widely available for important security parts of my sites. ***--this is after edition--*** there is also one thing is referral is entered as blank that is as you can make custom user agents then you may be able to enter the site and make it work in unwanted way. This is important fact. This post has been edited by hitmanblood: Jun 13 2008, 08:40 PM |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 5,876 Joined: 21-September 07 Member No.: 50,369 |
Post
#10
Jul 10 2009, 09:21 AM
PHP Referer check/redirect mostly useful. Check Referrer To Prevent Linking Yours From Other Sites While not foolproof, this script is now being used in my wife's website, www.Tiffany.Pro. What this script helps us do is prevent the average and most advanced folks from copying the pages that contain copyright work. We deployed the use of the jQuery thickbox plugin and a bit of javascript highlighting disabling functions. There are 2 ways to overcome this to copy the text, but the chances of people doing this are unlikely. The steps only took a half hour or so to take, and now she can self publish her work without worry that search engines and others will go out of their way to copy the text, where it might find it's way around the rest of the web. I think the author of this script, as it saved me the trouble of writing a custom script. -reply by Nicholas Maietta |
![]() ![]() |
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
1 | Etherion | 4,445 | 3rd August 2004 - 01:15 PM Last post by: tomko |
|||
![]() |
7 | Shibbeh | 4,672 | 7th August 2004 - 02:03 AM Last post by: Critical_Impact |
|||
![]() |
39 | Bash | 39,925 | 28th May 2009 - 01:47 AM Last post by: nol |
|||
![]() |
8 | hatebreed | 3,916 | 25th August 2004 - 02:21 AM Last post by: Zenchi |
|||
![]() |
36 | Bash | 12,338 | 10th November 2004 - 10:07 AM Last post by: finaldesign |
|||
![]() |
1 | Bash | 8,892 | 8th August 2004 - 09:03 PM Last post by: Torch89 |
|||
![]() |
21 | odomike | 9,426 | 24th August 2004 - 06:00 PM Last post by: odomike |
|||
![]() |
10 | holyium | 9,966 | 25th September 2004 - 12:33 AM Last post by: spyshow |
|||
![]() |
3 | jailbox | 9,169 | 11th August 2006 - 06:34 PM Last post by: juice |
|||
![]() |
5 | football123213 | 2,753 | 2nd September 2004 - 01:47 AM Last post by: football123213 |
|||
![]() |
40 | Too_Hot | 9,249 | 19th September 2004 - 09:19 AM Last post by: Too_Hot |
|||
![]() |
6 | dozen | 4,673 | 9th September 2004 - 11:58 PM Last post by: Triple X |
|||
![]() |
6 | spyshow | 6,332 | 24th June 2009 - 09:06 PM Last post by: iworld200 |
|||
![]() |
3 | ZPGames | 962 | 8th August 2007 - 05:51 PM Last post by: ZPGames |
|||
![]() |
11 | downpour | 6,566 | 2nd October 2004 - 11:06 AM Last post by: hulunes |
|||
|
Open Discussion | Time is now: 22nd November 2009 - 08:40 AM |
Web Hosting Powered by ComputingHost.com.