I have a password protected application where I use PHP to pull a selected client's information from a mySql database and create a FDF file to pre-populate the pdf with the client data. The user can modify and save this data on the form if they want. All of this works great, however, I would like to move my forms out of the website's root directory to prevent unauthorized access of the forms by someone typing in the direct url to the form.
I can successfully serve blank, unfilled pdfs from a folder outside the root by buffering it on the server and doing a readfile(). The problem comes with the PDFs I want to pre-fill with FDF data. I can create the fdf and store it outside the root but when I try to output it, Reader opens and says it can not find the PDF. I can not give an absolute URL to the PDF in the FDF since it is out of the root directory. I tried storing my PDFs in the same directory as my FDFs thinking that it would look there by default, but that does not work either.
Is there a way to reference the pdf in the fdf if the pdf is outside the root directory? (Everything I am seeing so far tells me this is not possible...)
I don't want to password protect the directory or the individual forms because the user already has to log in to get to the application.
If there is no way to store the fdf/pdf outside the root directory is there a way to add a "hidden" password to the pdf that I can pre-fill via the fdf if I keep my forms inside a website's public directory? That way legitimate users would not be prompted for a password, but someone trying to backdoor my forms would need to enter a password.
I don't know much about scripting inside a pdf so is there is a better/any way to secure my forms??
Thanks