how would i go about the following

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nabberuk
Forum Newbie
Posts: 6
Joined: Fri Oct 25, 2002 7:41 am

how would i go about the following

Post by nabberuk »

i need to protect my downloads from leechers, any ideas on the best way to do this in php?

thanks in advance
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

define leechers (or what kind of leechers you want to ban)
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

i think he wants to hide his download url volka....

if so then make a page with

Code: Select all

<?php
if(IsSet($file))
&#123;
header("location: path/to/download/folder/$file");
&#125;
else
&#123;
echo "what do you want?";
&#125;
?>
then link to it like

Code: Select all

<a href="page.php?file=filename.ext">Download</a>
um...is this the best way to do it?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

header('Location ....'); will lead to a 302 redirect (at least under apache) and the browser (at least IE ;) ) recognizes this and will store the new url.
once again: I'm not getting tired of pointing to this article Prevent Hotlinking with Apache Server Rewrite Module
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

well yes...but not everyone owns a server.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

.htaccess is the way to go.
nabberuk
Forum Newbie
Posts: 6
Joined: Fri Oct 25, 2002 7:41 am

thanks

Post by nabberuk »

thanks for all your answer, thi has helped me a great deal

thanks
nabberuk
Forum Newbie
Posts: 6
Joined: Fri Oct 25, 2002 7:41 am

one more thing

Post by nabberuk »

with the apache module thingy, will i have to write a htaccess file for each file i want to protect.

thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

since there can be only one .htaccess per directory the answer must be: no ;)

http://httpd.apache.org/docs/
Post Reply