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
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']);
}

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.