Skip to main content
New Participant
May 4, 2009
Question

How to organize page access

  • May 4, 2009
  • 3 replies
  • 698 views

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.

    This topic has been closed for replies.

    3 replies

    May 6, 2009

    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.

    Inspiring
    May 4, 2009

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

    Inspiring
    May 4, 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>

    VMISteveAuthor
    New Participant
    May 4, 2009
    No text available