Locked content?

Is there an easy way to unlock content only when a form is submitted?
I’d like to make available a few documents for download when people fill in a form.

I’m not afraid to write a bit of php myself, but if I can avoid it…

You won’t be able to protect the content entirely without some form of login system. But, if all you want to do is restrict the download content to those that fill in a form, you can place your download links on the thank-you page after form submission. Of course, if someone has the URL of that page, they could bypass your form, and possibly share the URL with others.

Yeah. That’s what I was initially thinking. Now, that could be solved by adding a little php script to check whether the submit button was clicked or not.

You could use an .htaccess file to check for the referring page. For example, place the page with your download links into a separate directory on the server. Create an .htaccess file in that directory that checks that the referring page is your thank-you page. In your thank you page you would create a link to the download directory. If someone tries to access the download directory from their browser using a direct URL, they will not be able to gain access - they will have to link from your thank you page. It’s not infallible, but it should be effective enough.

1 Like

Hmm. That will indeed not prevent visitors from downloading the files if they have the thank you page url. I’m solving it with a hidden form field and some php in an embed on the thank you page. Not 100% tamper proof either, but good enough for this purpose.

Good luck, let us know if it works well, I’m sure others may be interested in the solution.

Just an additional thought, you could put the thank you page in a protected folder containing the .htaccess check. This would ensure that the thank you page can only be accessed by clicking the submit button on the referring page.