Hi,

I have a question about using the application framework and sessions.  I
have an application that has a shopping cart.  I have an application.cfm
file in the root directory so that session variables are created right away
and use them to keep track of the items placed in the cart.

The cfapplication file looks like this:

<CFAPPLICATION NAME="xxxx"
   SESSIONMANAGEMENT="Yes"
   SETCLIENTCOOKIES="Yes"
   SESSIONTIMEOUT="#CreateTimeSpan(0, 1, 0, 0)#"
   APPLICATIONTIMEOUT="#CreateTimeSpan(2, 0, 0, 0)#"
   CLIENTMANAGEMENT="Yes"
   CLIENTSTORAGE="xxxx">

<CFLOCK TIMEOUT="30" THROWONTIMEOUT="Yes">
<CFIF NOT #ISDEFINED("Application.Started")#>
<CFSET APPLICATION.TITLE = "xxxx">
<CFSET APPLICATION.STARTED = TRUE>
</CFIF>
</CFLOCK>

<CFLOCK TIMEOUT="30" THROWONTIMEOUT="Yes">
<CFIF NOT #ISDEFINED("SESSION.STARTED")#>
<CFSET SESSION.STARTED = TRUE>
</CFIF>
</CFLOCK>

<CFLOCK NAME="session.sessionID" TYPE="exclusive" TIMEOUT="10">
<CFIF ISDEFINED('SESSION.CFID') AND ISDEFINED('SESSION.CFTOKEN')>
 <CFSET TEMPID = SESSION.CFID>
 <CFSET TEMPTOKEN = SESSION.CFTOKEN>
 <CFCOOKIE NAME="CFID" VALUE="#tempID#">
 <CFCOOKIE NAME="CFTOKEN" VALUE="#tempToken#">
</CFIF>
</CFLOCK>

I then go through a login process when they are ready to check out.  The
login process takes place in a subdirectory.  I've created an
application.cfm file in that subdirectory.  In it I force them to go through
the login form and the login check unless the a variable client.logged_in is
set.  Once they are successfully logged in the client.logged_in value lets
them carry on with their checkout.

My question is this:

In my subdirectory cfapplication.cfm file do I need to have a cfapplication
tag just like the one in the file in the root?  Or, can the
cfapplication.cfm file just contain something like this:

<CFLOCK TIMEOUT="30" THROWONTIMEOUT="Yes">
<CFIF NOT #ISDEFINED("Application.Started")#>
<cflocation url="http://www.xxxx.com/index.cfm"; addtoken="No">
<cfabort>
</CFIF>
</CFLOCK>

<CFLOCK TIMEOUT="30" THROWONTIMEOUT="Yes">
<CFIF NOT ISDEFINED("Session.Started")>
<cflocation url="http://www.xxxx.com/index.cfm"; addtoken="No">
<cfabort>
</CFIF>
</CFLOCK>

<CFLOCK TIMEOUT="30" THROWONTIMEOUT="Yes">
<CFIF NOT ISDEFINED("CLIENT.USER_NAME")>
<cflocation url="http://www.xxxx.com/subdirectory/index.cfm"; addtoken="No">
<cfabort>
</CFIF>
</CFLOCK>

Also, do I need to lock the client variable?


Thanks,

Eric Homa



______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to