download expire?

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
ecaandrew
Forum Commoner
Posts: 72
Joined: Fri Nov 12, 2004 5:05 pm

download expire?

Post by ecaandrew »

how would you make a encrypted download url expire? how would you make the encryption for it? thanks
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Make the link to the download be like download.php?id=<some long id number here> then on that page check the id number passed in the url in a database to see if its valid and hasnt expired - hold the expire time in the database. Then get the name of the file from the database that the id releates to and then force a download. Search the forums for force downloads if you dont know how to do this.

The "encryption" for the url is simply a unique md5() hash 32 chars long.
Post Reply