Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 11th, 2006, 7:03 AM   #1
leo1502
Newbie
 
Join Date: Apr 2006
Posts: 16
Rep Power: 0 leo1502 is on a distinguished road
How do I make a file downloadable only from my page?

Let's say I want anyone who downloads a file from my site to also view my site.
In other words I don't want anyone to be able to link to my downloads from their site.

How do I do that?

Thanks.
leo1502 is offline   Reply With Quote
Old Aug 11th, 2006, 7:17 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Protect the directory. Google for "hot linking."
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 11th, 2006, 8:12 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
If you have your own host with Apache running... you could block access to only those you want to allow in with .htaccess files.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Aug 11th, 2006, 8:20 AM   #4
leo1502
Newbie
 
Join Date: Apr 2006
Posts: 16
Rep Power: 0 leo1502 is on a distinguished road
and how do I let others download then from within my site?
leo1502 is offline   Reply With Quote
Old Aug 11th, 2006, 8:31 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Perhaps read your responses and investigate further? It is not a subject that would be adequately covered in any but a long thread full of the flecks of hogwash that tend to accompany such threads. .htaccess is, in fact, one of the methods of protecting oneself against the phenomenon. It is also available on some servers not your own (my provider gives me the capability). Researching hot-linking, as previously suggested, would include the use of .htaccess and even give you an example of how to construct such a file. Please indulge in some personal initiative.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 11th, 2006, 8:50 AM   #6
mleonid
Newbie
 
Join Date: Aug 2005
Posts: 12
Rep Power: 0 mleonid is on a distinguished road
I've googled for some solutions.
I see they check the REFERER, but it can be faked. How is it fixed?
mleonid is offline   Reply With Quote
Old Aug 11th, 2006, 8:55 AM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Dang!
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 11th, 2006, 9:00 AM   #8
Eoin
Hobbyist Programmer
 
Eoin's Avatar
 
Join Date: Jun 2006
Location: Ireland
Posts: 152
Rep Power: 3 Eoin is on a distinguished road
If you want to protect your files from other sites leeching sites it will really prove to be a non-trivial task and given the way HTTP works it would never be perfect.

That said you can make this harder for the leechers, checking the referer is an easy technique to implement, but also easy to get around. Maybe trying things like dynamicially generating URLs which only remain valid for a short time would be harder on the leechers, but also harder on you and probably your site.
__________________
Visit my website BinaryNotions.
Eoin is offline   Reply With Quote
Old Aug 11th, 2006, 9:33 AM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
What you say is true, concerning "protecting files" in general, though one can resort to secure channels and encryption. The OP has expressed an interest in preventing hot-linking. This is an issue of file protection as well as preventing theft of bandwidth. The solution is to prevent access to the directory containing the files in question from locations other than the site/server belonging to the owner. It is not difficult. The files are still accessible to the site/server for distribution in an authorized or permissable manner. This is not an arcane problem. The issue has been addressed countless time. There is a record of all that at the fingertips of one's browser (didn't know browsers had fingers, did ya?).
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 13th, 2006, 8:05 PM   #10
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
I don't know if this idea helps or that it could even be implemented in PHP, but you could encase the file in some sort of executable that would have to communicate with your server ensuring that the license hasn't already been activated (kinda like a registration/activation via the net). Also, you could deactivate text highlighting on the pdf file, which I believe is possible with Adobe Pagemaker.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OnlineTextEditor.Com! Sane Show Off Your Open Source Projects 43 Jun 16th, 2006 8:55 AM
Command Prompt SkyPioneer Coder's Corner Lounge 5 May 3rd, 2006 10:07 PM
add mutiple users to the smbpasswd file. Pizentios Bash / Shell Scripting 3 Oct 20th, 2005 12:48 PM
After execution - Error cannot locate /Skin File? wchar Visual Basic 1 Mar 5th, 2005 9:04 PM
airport Log program using 3D linked List : problem reading from file gemini_shooter C++ 0 Mar 2nd, 2005 4:12 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:47 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC