Solved

helpt o explan cookie syntax

Posted on 2004-10-07
4
172 Views
Last Modified: 2013-12-24
Can someone help me to under these 2 lines of syntax.

<cfset "client.cfid#client.CFID#.cftoken#client.CFToken#.username" = "">
<cfset "client.cfid#client.CFID#.cftoken#client.CFToken#.password" = "">

why the # sign?
0
Comment
Question by:xiaobao68
4 Comments
 
LVL 5

Accepted Solution

by:
kkhipple earned 25 total points
ID: 12248973
CFCOOKIE livedocs
http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/Tags-pt119.htm

<cfset "client.cfid#client.CFID#.cftoken#client.CFToken#.username" = "">
<cfset "client.cfid#client.CFID#.cftoken#client.CFToken#.password" = "">


The #'s signs are used to grab the variable values.  
If you place <CFOUTPUT></CFOUTPUT> tags around the variable, then you can view the value.

<CFOUTPUT>
#client.CFID#
</CFOUTPUT>  

If you want to view the value of the above two set statements :

<CFOUTPUT>client.cfid#client.CFID#.cftoken#client.CFToken#.username</CFOUTPUT>

Actually its an interesting bit of code. It defines a unique username and password variable.

Possible for authentication/authorization.
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 25 total points
ID: 12250463
The reason that the # is needed is becuase it is within double quotes.

You could get the same result with the following code:

<cfset Client["cfid" & client.CFID & ".cftoken" & client.CFTOKEN & ".username" = "">
<cfset Client["cfid" & client.CFID & ".cftoken" & client.CFTOKEN & ".password" = "">

It is NOT setting a cookie.  It is setting a client variable.

So if client.CFID = 12 and Client.CFTOKEN = 1T67YA85 then you actually have the statements

<cfset Client.cfid12.cftoken1T67YA85.username = "">
<cfset Client.cfid12.cftoken1T67YA85.password= "">

Personally I am not sure why you would go to this trouble of such a complex variable name for a user's username and password.  There are much simpler ways to make usique username and password variables without having so many layers deep.  And it would be very messy to use later in your pages....
0

Featured Post

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now