Solved

helpt o explan cookie syntax

Posted on 2004-10-07
4
175 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
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…
A short film showing how OnPage and Connectwise integration works.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

943 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

4 Experts available now in Live!

Get 1:1 Help Now