Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

Implementing downloadable merchandise?

How would one automatically send a link to a user that has paid for a downloadable merchandise. For this example, let's say an e-book. The user pays for an e-book and a link is automatically generated for them to download it. I will of course have the e-book file on the server. However, users should not have access to that file by just typing in the link in the browser. So does one implement this?

I also added more points to the question for suggestions for 3rd party software. So if you can recommend some software to use, that will help as well. This is so that I have the option of creating it myself, or buying it.

Thanks.
0
EVelasco
Asked:
EVelasco
  • 2
2 Solutions
 
ThGCommented:

There are lots of answered questions that will help you:
http:Q_21237176.html 
http:Q_21131507.html
http:Q_20439354.html

And also this external tutorial can be interesting:
http://www.wazzup.co.nz/tutorials/protect_pdf/index.php

Regards
0
 
gruntarCommented:
<?php
// add your check code here to see if order exist


// open the file in a binary mode
$name = $_SERVER['DOCUMENT_ROOT'] . '/filedir/' . $_GET['file'];
$fp = fopen($name, 'rb');

// send the right headers
// you should change that
$ext =  array_pop(explode('.', $_GET['file']));

switch ($ext){

      case 'zip':
            header("Content-Type: application/x-zip-compressed");
      break;
      case 'doc':
            header("Content-Type: application/msword");
      break;
}

header("Content-Length: ".filesize($name));

// dump the picture and stop the script
fpassthru($fp);
exit;

?>

then in your .htaccess file you limit GET requests for "filedir" folder. put htaccess file in images folder

<Limit GET POST>
order deny,allow
allow from all
</Limit>

hope that helps you with your code. If you have any questions just ask...
cheers
0
 
gruntarCommented:
eh, my mistake again. Last code is like this..

<limit GET POST>
  order deny,allow
  deny from all
</limit>
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now