ColdFusion Kinky eCards Update

Posted March 11, 2008 at 11:57 AM by Ben Nadel

Tags: ColdFusion

Just fixed a small bug in my ColdFusion Kinky eCards Hayden Panettiere demo application. In the OnSessionStart(), I was clearing the session data. However, I was throwing the baby out with the bath water, so to speak, and was actually deleting the CFID and CFTOKEN as well. I am not sure if this was causing any bugs, per say, but I would definitely consider this to be a bad practice. Now, the new code, which can be downloaded from the Kinky eCards Project page has a modified OnSessionStart() event method that restores the CFID and CFTOKEN values after the SESSION scope is cleared:

  • <cffunction
  • name="OnSessionStart"
  • access="public"
  • returntype="void"
  • output="false"
  • hint="Initializes the user's session.">
  •  
  • <!--- Define the local scope. --->
  • <cfset var LOCAL = {} />
  •  
  • <!--- Store the use ID / TOKEN values before we clear. --->
  • <cfset LOCAL.CFID = SESSION.CFID />
  • <cfset LOCAL.CFTOKEN = SESSION.CFTOKEN />
  •  
  • <!---
  • Clear the session. We should do this incase we
  • are re-initializing.
  • --->
  • <cfset StructClear( SESSION ) />
  •  
  • <!--- Restore the ID/TOKEN values. --->
  • <cfset SESSION.CFID = LOCAL.CFID />
  • <cfset SESSION.CFTOKEN = LOCAL.CFTOKEN />
  •  
  • <!---
  • Set up a struct to hold the form data. We the need
  • the form data so that the user can go back and forth on
  • multi-page forms (ex. enter data and preview eCard).
  • --->
  • <cfset SESSION.FormData = {} />
  •  
  • <!--- Return out. --->
  • <cfreturn />
  • </cffunction>



Reader Comments

May 17, 2008 at 7:43 AM // reply »
1 Comments

Thanks for info. Excellent article...


Jul 3, 2008 at 3:04 AM // reply »
1 Comments

Ben, great fix. Thanks a lot!


Jul 9, 2008 at 4:10 AM // reply »
2 Comments

I'm new here and new to ColdFusion, but i'm a fan of ColdFusion too, thanks for the update, i'm reading the code line by line, hope can get some idea about eCard
Thanks


Jul 11, 2008 at 8:52 AM // reply »
2 Comments

I'm new here and new to ColdFusion, but i'm a fan of ColdFusion too, thanks for the update, i'm reading the code line by line, hope can get some idea about eCard
Thanks


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Jun 20, 2013 at 3:15 AM
A Billion Wicked Thoughts By Ogi Ogas And Sai Gaddam
nice post i love it thanks 4 u :) ... read »
seb
Jun 20, 2013 at 2:32 AM
Working With Inherited Collections In AngularJS
@mike, @ben, The best article about scope and prototypal prototypical inheritance in angularjs is http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical- ... read »
Jun 20, 2013 at 2:17 AM
ColdFusion NumberFormat() Exploration
Nice read thanks Ben, Is there a way to mask a negative number? Long story short in the finance sector when you go 'short' on a stock you want the price to fall this is a good thing because you are ... read »
Jun 20, 2013 at 1:09 AM
The Beauty Of The jQuery Each() Method
my html code : <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="nss.js"> ... read »
Jun 19, 2013 at 11:31 PM
Directive Link, $observe, And $watch Functions Execute Inside An AngularJS Context
@Ben, bunch to learn indeed, but thats fun part : ) ... read »
Jun 19, 2013 at 10:41 PM
Referencing ColdFusion Query Columns In A Loop Using Both Array And Dot Notation
Burdock-roots Are you going fat day by day? You need to be good for your family and make some money too. So we bring for you a best product that helps you to be more energetic every day. You will b ... read »
Jun 19, 2013 at 9:52 PM
Working With Inherited Collections In AngularJS
I recognize the applicability of your solution, and how easy it makes to share data across multiple views or even "submodules" of rather simple application. But it seems to me that it creat ... read »
Jun 19, 2013 at 9:38 PM
Directive Link, $observe, And $watch Functions Execute Inside An AngularJS Context
@Alesei, Glad you like it. Even after working with AngularJS for months, I still get a bunch of unexpected, "$digest is already in progress". So hard to debug sometimes! ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools