Protecting a white paper or other content behind a form submission

What html code do I use to route someone to a web form for info before they can download a whitepaper from my site?

For HTML, you will use FORM, LABEL, INPUT and any other tag that you would use in a form.

Then you’ll need some kind of programming language so when it is submitted, it will execute wahtever action you want. Use whatever you please, Javascript, PHP… It might be safer to use a backend programming language though

only if you are running it on the server - eg. Node

I don’t necessarily agree. You only need backend processing if you’re saving information on a database or something similar. But if it is just to build a link to download the file, it may not be necessary.

Not that I would use Javascript for the job anyway. Too dangerous if someone decides to look at the script and build the links himself… so I would use a backend language anyway. But it is still possible even if Node.js is not used, depending on the processing that has to be done.

Seems to be a key word here, suggesting this is being done with security in mind.
To protect data from anyone who should not see it, I think back-end is the way to go.
But the question is a bit vague. More specific info about the type of protection and form input required would help.

1 Like

I have this page of whitepapers.

http://www.radley.com/Learn/whitepapers.html

The link to go to the form works, but the download doesn’t. I need to figure out how to fix this.

You can;t use JavaScript - that would deny access to anyone with it disabled on not available in their browser unless they read the JavaScript to work out where to go (as anyone else can do without filling out the form).

1 Like

It looks as if the form is using javascript, which I can’t help with, as I don’t know javascript.
The form requires the entry of a name, company and email address. But what happens to that data? Is it then stored somewhere? The form has no action, so I guess there is no back-end processing.

1 Like

Right. I need to add the backend processing, but I don’t know how to do that. Any suggestions?

It depends on what backend processing you have available from the host, or may be familiar with.
PHP is a common one, but there are others.
Also depends on exactly what you want it to do. Presumably you want to store the data the user inputs, so that may require some sort of database.

I’m not a web designer, so I’m familiar with nothing :laughing:

I’m pretty sure there’s no inherent backend processing available from the host–we host the site ourselves and it’s just a folder on the server of all the html files of the site.

So any protection would need to be built into the document itself - eg. a password protected PDF.

Could you could install PHP on the server?

So there’s no way to collect information from the visitor?

You will need backend processing to do that. Frontend scripts act only on the visitors machine, you need something on your server to store or send the data.

I can probably install PHP. What does that do?

There’s a question…

http://php.net/manual/en/intro-whatcando.php

PHP is a server side language. This means the server processes the code before it gets to the client machine so it cannot be changed. If you do something in javascript it is client side and the code can be seen by the client.

If you are running php/mysql i’d perhaps look at storing the document in the mysql database. Once the form has been submitted you could then output the file and give it automatically generated name that would only last for that download. If anyone tried to go to the file directly it wouldn’t exist anymore.

If you didn’t want to store it in the database you could put the files in a protected folder and use PHP to copy the file and again rename before allowing download so the original doc cannot be accessed.

1 Like

Maybe I’m making this too hard. What if I wanted to just have the visitor complete the form and have that data emailed to me? Would I still need a backend database of some sort?

there are ways of getting the server to mail without php but i use php as it’s pretty simple once you get the hang of it.

If you don’t mind the risk of people finding the paper without going through the form you can just stick the papers in a folder and have a form that outputs a link on the success page.

It really depends on how much security you want.

I remember expertsexchange which was(is?) a coding website that gave answers to questions but you had to subscribe/pay to get the answer… unless you bothered to scroll for like a mile and realized that the answers were just hidden at the bottom of the page :slight_smile: Most people wouldn’t bother to scroll to find it and just subscribe/pay

1 Like