Hi. I'm trying to make a site where people can purchase zip files. The zip files will be made on-the-fly. My question is: how do I restrict access to the files? I need to make it where the zip file can only be downloaded once, and it can only be downloaded once the person purchases the file.

Any suggestions?

Thanks

Recommended Answers

The way it is done on some sites: after buying a key is generated (and the zip file in a protected location) in the database and e-mailed to the buyer. He can then access a download.php using that key. After 30 minutes, the key expires and the download.php will not …

Jump to Post

All 2 Replies

The way it is done on some sites: after buying a key is generated (and the zip file in a protected location) in the database and e-mailed to the buyer. He can then access a download.php using that key. After 30 minutes, the key expires and the download.php will not return the file (download.php does have access to the protected location).

Actually downloading just once is not very user friendly, because you cannot make sure the buyer actually has the file stored. But you can achieve this by expiring the stored key, or changing it (so he can request a re-download).

@pritaeas: Thanks!
I'll try that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.