Log in

View Full Version : Download page using php and auto-link creator



auriaks
01-31-2010, 02:46 AM
Hey,
I have downloaded files from many webpages before. The main thing is that when I pushed Download, it redirected me to other white page, then showed save table, and when downloading begin it dissapered. And I thought tah I need sometjing like that. It would let download file by only users and noone will know the exact dirrection where I keep the file...

If you understood what I want, help me. If you need more info, ask..

Thanks :)

Nile
01-31-2010, 05:40 AM
Just use php include (I think that should work). Or do:


header("Content-type: text/...");

auriaks
02-01-2010, 05:30 PM
What you mean include?

I want to create a link which will dissapear after some time, so noone will use my files' links in their sites.

bluewalrus
02-01-2010, 06:14 PM
You could rename the file after every download, and only allow access to the pages if the users are logged in.

http://php.net/manual/en/function.rand.php

http://php.net/manual/en/function.rename.php

You should store the original name and the being changed name somewhere though so you can keep track.

djr33
02-01-2010, 07:05 PM
You should look at ways to block 'hotlinking', I think.

Alternatively, create a php download page that grabs the file and serves it to the user. Use a database with random names. That way no one knows the real URL of your file. You can change things with that.

auriaks
02-01-2010, 07:23 PM
But function rand changes only number... and if that link will be used in other file?

bluewalrus
02-01-2010, 07:31 PM
I don't know what you mean post some of the code for what you're doing. I assumed you were using a database and that the link was being pulled from there on the referring page and the download page.