Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

helpt o explan cookie syntax

Posted on 2004-10-07
4
Medium Priority
?
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

610 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