I've gone back over my code and made sure that locking is working OK.
There are no nested locks, I only work with session vars in this small app
so have limited it all to the session scope with exclusive locks for
anything that does a CFSET and READONLY for anything that tests the vars.

Just to make sure, I configured the Administrator to do full checking for
the session scope on my dev box and it didn't complain about a thing.

No users have logged on since this morning so I can't know for sure if the
problem is nailed.
I'm going to ask the client to send out the invtation emails to users to try
the survey again.
Fingers crossed.


The page that complains is the survey form's action page, below.
The Application.cfm is below that again.


<cftry>

        <!--- Don't update and redirect to the thank you page if this is the
guest user --->
        <cflock timeout="10" throwontimeout="No" type="READONLY"
scope="SESSION">
                <cfif session.username is "vng1001" and session.password is
"vng">
                        <cflocation url="thankyou.cfm" addtoken="No">
                </cfif>
        </cflock>

        <!--- Update the records --->
        <cfupdate datasource="#DSN#" tablename="tbl_VNG" dbtype="ODBC">
        
        <!--- Record the survey as having been completed --->
        <cflock timeout="10" throwontimeout="No" type="READONLY"
scope="SESSION">
        <cfquery name="qry_MarkCompleted" datasource="#DSN#" dbtype="ODBC">
                UPDATE tbl_vng SET SurveyCompleted = True
                WHERE password = #session.password#;
        </cfquery>
        </cflock>
        
        <!--- Redirect to the thank you page --->
        <cflocation url="thankyou.cfm" addtoken="No">

<!--- I've just put this as any for the moment because I'm not sure what's
causing the problem --->
<CFCATCH TYPE="Any">    
    <cfmail 
        to="[EMAIL PROTECTED]" 
        from="[EMAIL PROTECTED]" 
        subject="Error Occured" 
        type="HTML">

        A ton of of diagnostic code.  Works fine.

    </cfmail>

        <script>
                alert('There was a problem updating the database, click OK
to to re-submit.');
                history.go(-1);
        </script>
        
  </CFCATCH>

  </CFTRY>


********************  Application.cfm *******************************
<cfapplication name="VNG_Employee_Opinion" clientmanagement="Yes"
sessionmanagement="Yes" setclientcookies="Yes"
sessiontimeout="#CreateTimeSpan(0, 1, 0, 0)#">

<!--- This sets the Data Source Name for all the queries --->
<cfparam name="DSN" type="string" default="vng_emp_opinion">

<!--- Set up a flag as to whether the distribution app should automtically
email --->
<cfparam name="application.auto_email" default="TRUE">

<!--- Set up the authentication and other flags --->
<cflock timeout="10" throwontimeout="No" type="EXCLUSIVE" scope="SESSION"> 
<cfparam name="session.authenticated" type="boolean" default="FALSE">
<cfparam name="session.username" type="string" default="">
<cfparam name="session.password" type="string" default="">
<cfparam name="session.authenticate_failure" type="boolean" default="FALSE">
<cfparam name="session.login_directory" type="boolean" default="FALSE">
<cfparam name="session.insert_failure" type="boolean" default="FALSE">
</cflock>

<!--- Dissociates the seesion vars if the browser closes. --->
<CFIF IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>
        <CFSET cfid_local = Cookie.CFID>
        <CFSET cftoken_local = Cookie.CFTOKEN>
        <CFCOOKIE name="CFID" value="#cfid_local#">
        <CFCOOKIE name="CFTOKEN" value="#cftoken_local#">
</CFIF>

<!--- This tests to see if we're in the login directory --->
<cflock timeout="10" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
<cfif FindNoCase("/login/", #cgi.script_name#) NEQ "0">
        <cfset session.login_directory="TRUE">
<cfelse>
        <cfset session.login_directory="FALSE">
</cfif>

<!--- This tests to see if we're in the admin directory --->
<cfif FindNoCase("/admin/", #cgi.script_name#) NEQ "0">
        <cfset session.admin_directory="TRUE">
<cfelse>
        <cfset session.admin_directory="FALSE">
</cfif>
</cflock>
<!--- Test to see if authenticated and if not direct the user to the login
screen
                or if a non-admin user is trying to access the admin screen
--->
                <!--- OR (session.admin_directory EQ "FALSE" AND
session.username NEQ "Admin") --->
<cflock timeout="10" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
<CFIF session.login_directory EQ "FALSE">
        <cfif IsDefined("session.authenticated") is "FALSE" OR NOT
session.authenticated is "TRUE">
                <cflocation url="login/login-form.cfm" addtoken="No">
        </cfif>
<cfelseif (session.admin_directory EQ "TRUE" AND session.username NEQ
"Admin")>
        <cflocation url="login/login-form.cfm" addtoken="No">
</cfif>
</cflock>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to