By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,823 Members | 756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,823 IT Pros & Developers. It's quick & easy.

Looking for script to do a "controlled download"

P: n/a
Hi,
I have a PDF file on my site that I want to distribute freely but I want to
be able to contact anyone who downloaded it to warn them about mistakes and
modification and new versions and updates...

So I need some way to keep their email addresses and someway to prevent them
sharing the link to the PDF file.

I've seen some sites
- with a form for the user to fill in
- where the client fills in his email address
- and receives a mail
- containing a unique link to the file to download
- and I think the link has a timeout on it somehow.

Can anyone point me to a script so that I can set up something similar?

TIA

Joey


Apr 12 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Joey,

For controlling the download you need to:
1. make sure the file can only be downloaded through a script
2. add some code to the script to control the dowlnoad.

For the first you need to put the file somewhere where your php script
can read it but the visitors of your website can not. Then how to write
the script you can find in the user comments on:
http://nl2.php.net/manual/en/function.header.php

The last is just a matter of putting a form on you website that visitors
have to fill out. You let the form call the download script. Make the
download script check if the form has been filled out properly. If it
has, you store the info in a database or have it sent to your own email
address, then continue with the download. If not, you print some error
message and let them try again.

"The last" is really very basic php, i assume you can do it, if not,
just look around for some beginners tutorials, there must be thousends
of them out there. The first is a bit tricky, i suggest you first
experiment with the code for reading and printing a file until you can
successfully get a html file displayed through the script, then
experiment with the header stuff until you get it working with pdf as well.

I agree this is more work then a ready made script, but in the end you
will be really in control.

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

Joey Nolan schreef:
Hi,
I have a PDF file on my site that I want to distribute freely but I want to
be able to contact anyone who downloaded it to warn them about mistakes and
modification and new versions and updates...

So I need some way to keep their email addresses and someway to prevent them
sharing the link to the PDF file.

I've seen some sites
- with a form for the user to fill in
- where the client fills in his email address
- and receives a mail
- containing a unique link to the file to download
- and I think the link has a timeout on it somehow.

Can anyone point me to a script so that I can set up something similar?

TIA

Joey

Apr 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.