?
Solved

helpt o explan cookie syntax

Posted on 2004-10-07
4
Medium Priority
?
191 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
2 Comments
 
LVL 5

Accepted Solution

by:
kkhipple earned 100 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 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

862 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