Jump to content

Secure Timed Downloads


karldesign

Recommended Posts

Hi all,

 

I want to sell my work online, but i only want to show thumbnails/samples.

 

When a user purchases using PayPal IPN, I want the real image to be available for 24 hours. This file will then delete after this time...

 

Similar to iStockPhoto style of purchasing, so each link is unique...

 

How is this achievable, in a simple way?

Link to comment
https://forums.phpfreaks.com/topic/99028-secure-timed-downloads/
Share on other sites

One way would be to use a php file to read the images and serve them to the web page.

 

html file:

<img src="image.php?file=filename.jpg" />

 

image.php:

if ($validUser) {
    // display image to browser
    header('ContentType: image/jpg');
    echo file_get_contents($_GET['file']);
}

store files behind the site root.

 

use the users login status to verify who they are OR on successfull purchase provide them with a code they must enter to get the download.

 

store code in the database and associate with the file in question...

 

use php to create a zip file of the item they have purchased (you can even password protect if you like but you'll have to email that password to the user) and download it using something like http://www.phpit.net/code/force-download/ - this kind of script can access files behind the site root...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.