?
Solved

Implementing downloadable merchandise?

Posted on 2005-02-26
3
Medium Priority
?
220 Views
Last Modified: 2012-06-27
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
Comment
Question by:EVelasco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
ThG earned 1300 total points
ID: 13412706

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
 
LVL 9

Assisted Solution

by:gruntar
gruntar earned 300 total points
ID: 13413357
<?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
 
LVL 9

Expert Comment

by:gruntar
ID: 13413362
eh, my mistake again. Last code is like this..

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

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question