Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Joey Nolan
April 12, 2007, 8:33 am
rate this thread
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?
Re: Looking for script to do a "controlled download"
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:
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.
Joey Nolan schreef:
- » For gurus: bug in php? Recursive foreach dont work properly.
- — Previous thread in » PHP Scripting Forum