Hi suzanne, you can add this bit of code to the page template that's being used for your redirect page. It will check to be sure they came from the form page, and if not, will direct them to the form page. You can copy the page template that's currently being used to serve your redirect page, and just add this code to the top, after the template name. Be sure to edit your page and select this new template.
[php]
$form_url = 'http://gravity.chrishajer.com/check-referer/';
if (!($_SERVER['HTTP_REFERER']==$form_url)) {
header("Location: $form_url");
exit;
}
Change the "form_url" value to the URL where your form lives, the one you want people to be coming FROM before they can see the confirmation. The code says "if the HTTP_REFERER is not the form page, redirect them to the form page and exit."
Try to access this page:
http://gravity.chrishajer.com/hidden-thank-you-page/
You will be redirected to this page:
http://gravity.chrishajer.com/check-referer/
If you submit the form there, you will be shown the confirmation page which is located here:
http://gravity.chrishajer.com/hidden-thank-you-page/
The HTTP_REFERER can be forged or modified by the browser, so this is not a super secure solution, but it will prevent direct access to the page by people who just share the URL.
I also hid it in my list of pages, so it's not so obvious it's there.
Posted 12 years ago on Sunday October 16, 2011 |
Permalink