Copy link to clipboard
Copied
I have a conference registration site that does the usual things: page that asks for registration information, next page verifies that information, and then a page with a cfquery that inserts that information into a dababase. My question concerns how best to force users to follow that order. I don't want a user going directly to the verify page before he has entered any registration information and I don't want the page with the cfquery being accessed before the verify page has successfully been performed. I could use cgi.referrer to check the referring page and make sure it is the right one, but is there another approach?
Thanks for any help.
Copy link to clipboard
Copied
If your verify page is expecting a form to be submitted to it, you can show the page after a conditional statement checks for the existence of an expected form field.
For example, assuming the registration page has a field called first_name, you could add the following code to the top of your verify page:
<cfif NOT StructKeyExists( form, "first_name" ) >
<cflocation url="registration_page.cfm" addtoken="false" />
</cfif>
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are always other approaches. In this case, none of them are as good as the one you have in mind.
Copy link to clipboard
Copied
I think this would be best handled using a session for the user and keeping a track of what has been completed and what hasn't.
You could thn run some if / else on this session struct to see if they're allowed access. If not, then cflocation them back to wherever.
The problem with using cgi.referer is that it's not very fullproof and all you can do is check where they've come from...it wont allow you to gather information about WHAT has been done so far etc. Session will help you to do this.
Mikey.