View Full Version : how to prevent downloading files
is there a way to prevent people from downloading files from the site, just by typing the actual location and filename in browser address line.
I understand that leeching is if someone links to a file from their site, but what do you call this? Anyone that knows or guesses a filename can just type it into address bar and file downloads, no matter what's in .htaccess
thanks
alphadesk
11-14-02, 10:28 PM
Jake,
You can put those files in it's on folder and have a gateway page to that folder password protected. The gateway page comes up you put in username/password and it lets you get to the ones protected.
thanks for fast response, unfortunately that won't work. These files are real media files used in links on my pages to play from embedded realplayer control on each page. if i password protect the files, visitors won't be able to "play" these pages, unless they know the password, which is not desirable.
any more ideas?
Thanks
jake
alphadesk
11-15-02, 12:02 AM
Nope, not really. Sounds like you will have to just live with it, considering the situation. Maybe someone else will.
kanwulf
11-15-02, 01:28 PM
You could use a Perl script to call the links. The script could prevent them from loading except when called from the page you desire.
If the true URL of the media was known it could still be used but the true URL would be near impossible to guess.
You link would be to your script and a query string would be added to the end of it to id the media. Only the script itself would know where that media is located to retrieve it. And it would only retrieve it if it meet you criteria.
using a script is exactly the approach I have been working on for one of my sites.. where leaching is a problem to an extent, but at the same time, I dont mind a little bit of leaching.
So my script does the following:
Checks the referal tag to see where they browsed from. If it was from my site, then I do not restrict access
However, if not, then I take note of the IP address that the request is coming from, along with the actual referrer, and some other bits of data and put that in a mysql table.
Then I do a query and see if that referrer is used more than a few times within the last hour. If so, then I provide them with an alternate image instead, telling them to go to my main site to view the image.
If all is ok and that referer is not in the table too many times, then I give them the image that they want.
Then, I have a cron task that clears up old records of the table once a day or so.
script approach was in my mind, if i only knew how to write it. Any of you guys have a script that could do this. i would appreciate it.
thanks
jake
kanwulf
11-16-02, 01:00 AM
I don't have a complete one ready but Perl snippets are very portable. I can put something together in a short matter of time with what I have laying around.
PM me with some details. Exactly what you want and don't want to happen.
I'll put something together for you provided I can make the time. Right now looks pretty good for fitting it in. ;)
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.