>> interesting. How do you handle poeple with cookies disabled?
Michael,
The main reason to use cookies is to maintain state between requests (pages)
within the site. The two ways to maintain state on a web site is with a
cookie or with a URL variable. I typically design my sites (where state is
important) assuming that cookies are NOT enabled.
I use a URL session token appended to each hyper-link to maintain state.
Then if cookies ARE enabled you can make the token a null string and let the
cookies work.
I use this code in my application.cfm file. Like so:
<!--- Step 1 Determine if Cookies are enabled --->
<cfif IsDefined("Cookie.cookieenabled")>
<cfset TokenOn="No"> <!--- No token required cookies are on --->
<cfelse>
<!--- A token is required cookies may be off or their fist visit --->
<cfcookie name="cookieenabled" value="test" expires="30">
<cfset TokenOn="Yes">
</cfif>
<!--- Step 2 Now set a global urltoken to use throughout the site --->
<cflock timeout="30" throwontimeout="No" name="#LockName#">
<cfif TokenOn is "Yes">
<cfset Token="&" & #Session.URLToken#>
<cfelse>
<cfset Token=''>
</cfif>
</cflock>
I can then design the rest of the site to add the variable #Token# to the
end of all hyperlinks.
<a href="http://www.somedomain.com/pag1.cfm?#Token#>my link</a>
or with other variables:
<a href="http://www.somedomain.com/page2.cfm?ID=3#Token#>next link</a>
Having the test in the application.cfm file insures that no matter which
page on the site they see first the test is always run. State will always
be maintained even if cookies are off.
Also if this is the first time they visited the site, then on the second
page they hit you can turn off the Token and know that cookies are enabled.
I hope that helps.
Best regards,
Dennis Powers
UXB Internet
(203)879-2844
http://www.uxbinfo.com/
-----Original Message-----
From: Michael T. Tangorre [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 31, 2001 12:13 AM
To: CF-Talk
Subject: Re: sessions and shopping carts
Hmmmm
interesting. How do you handle poeple with cookies disabled?
Would it be better to focus on the higher percentage of people with cookies
turned on? I am not opposed to using a different method at all.. like I
said I want to learn. Would it be better to have a table in the DB called
Carts maybe that stored all the products and the cart ID??
Thanks for the input, its helping me sort things out here.
Mike
----- Original Message -----
From: "Matt Robertson" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, October 30, 2001 11:47 PM
Subject: Re: sessions and shopping carts
> If you're going to use sessions without cookies, you're going to have to
> pass the CFID and CFTOKEN from template to template via the url. You're
> also going to have to make sure that, since you are exposing the urltoken,
> that you take steps to see to it that users sharing links don't also share
> sessions. Maybe run a referrer test or something, and issue a new
urltoken
> if the referrer is blank or from another site.
>
> I'm not a big fan of session management unless its absolutely necessary.
My
> early experiences with clients hosting on shared servers taught me not to
> count on it (CF failover restarts wash out all session vars). On a
> dedicated, stable box the problem doesn't exist, but old habits die hard.
>
> There also are some things you can't do if storing cart data in memory.
> Truly real-time inventory control, in particular. If you store cart data
in
> a db, when a user puts something in a cart you can decrement available
> inventory from the db and hold the item for the consumer during the
shopping
> process, just like a cart in a real store.
>
> Just my .02. Plenty of opinions on the other side of the fence, of course
> ;D
>
> -----------------------------------------
> Matt Robertson [EMAIL PROTECTED]
> MSB Designs, Inc. http://mysecretbase.com
> -----------------------------------------
>
> ----- Original Message -----
> From: "Michael T. Tangorre" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 30, 2001 6:27 PM
> Subject: sessions and shopping carts
>
>
> Hey everyone.
>
> I am working on my first shopping cart to get the ideas downa nd in
> place, and I am working towards a cookieless shopping cart, so I need to
> use sessions more than ever now. I have a few concerns though.
>
> I was thinking of approaching it this way, but I am not experienced
> enough to know what the downsides are, so I am open for suggestions and
> tips.
>
> Mike
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists