Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to organize page access

New Here ,
May 04, 2009 May 04, 2009

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.

643
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 04, 2009 May 04, 2009

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2009 May 04, 2009
 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2009 May 04, 2009

There are always other approaches.  In this case, none of them are as good as the one you have in mind.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 06, 2009 May 06, 2009
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources