Sure, you can use PayPal's IPN service to permit the download once payment has been confirmed.
* Create a database record, indicating purchased file, hashing users IP and browser agent, add a cookie too
* Send to PayPal for payment
* Provide user a unique URL for this download
* Once payment has been confirmed, enable download in database for set period of time
That's usually the, very rough, gist of it.
PHP Code:
<?php
/*
Get the download where the browser and ip is the
same as the user who paid, and has the cookie value,
and is paid for, and where the number of downloads
is less than or equal to 2.
*/
$sql = sprintf(
"SELECT
file
FROM
purchases
WHERE
paid = 1
AND
ua = '%s'
AND
ip = '%s'
AND
hash = '%s'
AND
downloads <= 2;",
mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']),
mysql_real_escape_string($_SERVER['REMOTE_ADDR']),
mysql_real_escape_string($_COOKIE['hash'])
);
Bookmarks