Download, then unlock
Moderator: General Moderators
Download, then unlock
I am building a PHP site for a small business where the customer should be able to download a file and then get a key in the mail to unlock it when he/she has paid. Anybody who knows where to find methods for this?
- DaveTheAve
- Forum Contributor
- Posts: 385
- Joined: Tue Oct 03, 2006 2:25 pm
- Location: 127.0.0.1
- Contact:
Re: Download, then unlock
Have the original uncompressed file uploaded to a non-public folder on the site, then when the user pays for it, have PHP run the command line to compress the orginal file to a /tmp file with the key you will email the buyer and present that compressed file to the buyer to download.
Re: Download, then unlock
Thanks, sounds simple enough. Could you give some advice about compression/encryption methods, too?
- DaveTheAve
- Forum Contributor
- Posts: 385
- Joined: Tue Oct 03, 2006 2:25 pm
- Location: 127.0.0.1
- Contact:
Re: Download, then unlock
Code: Select all
system('zip -P pass file.zip file.pdf');Also, This should help you as well.
Re: Download, then unlock
Thanks again, embarrassed I didn't find that myself.
- DaveTheAve
- Forum Contributor
- Posts: 385
- Joined: Tue Oct 03, 2006 2:25 pm
- Location: 127.0.0.1
- Contact:
Re: Download, then unlock
Don't worry about it. I ask lots of questions here and half the time I feel stupid too. It's just a part of learning!
Re: Download, then unlock
Another option would be to encrypt the pdf file itself on the fly with php. You can also use php to automatically generate the pdf file as well, and use php do allow them to download it upon payment (with automatic confirmation like through paypal verifying it with their IPN API).
You could also design an entire system for it. User accounts allowing them automatic and immediate access to the resource they have paid for, right away when they make their payments. PHP can then stream them the pdf from a protected directory.
... which would eliminate the need to "protect" and "unlock" your pdf's.
Automation is a good thing. Saves valuable time and money.
PHP's PDF Manual
Protect PDF Files with PHP
PayPal Instant Payment Notification (IPN) Introduction
PayPal Instant Payment Notification (IPN) Code Samples
You could also design an entire system for it. User accounts allowing them automatic and immediate access to the resource they have paid for, right away when they make their payments. PHP can then stream them the pdf from a protected directory.
... which would eliminate the need to "protect" and "unlock" your pdf's.
Automation is a good thing. Saves valuable time and money.
PHP's PDF Manual
Protect PDF Files with PHP
PayPal Instant Payment Notification (IPN) Introduction
PayPal Instant Payment Notification (IPN) Code Samples