Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the data out of the COOKIE (CGI variable)

Status
Not open for further replies.

Pahan

Programmer
Jul 22, 2002
6
0
0
US
Among the CGI variables that are displayed when I preview how my app works in IE, I have HTTP_COOKIE. The line looks like this:
HTTP_COOKIE=MYINTRANET_USERID=CF42912; language=En; MYINTRANET_USERINFO=UID=Guest&NAME=Guest&MAIL=myIntranet1.0_Guest@pcs.com&C=??? EMPTYPE=CONTRACTOR&SUPCODE=N&GLOBALID=0

All this information located on one line, so I guess it is the content on the cookie.

Now, how do I get the MYINTRANET_USERID from here?

The other lines under CGI variables of the type HTTP_HOST=myserver.com give me no troubles, as I can simply say
myVar = CGI.HTTP_HOST and I get myserver.com.

Any suggestions?
 
Hi,

try

<cfset MYINTRANET_USERID =listgetat(cgi,HTTP_COOKIE, 2, &quot;=,;&quot;)>
it should return CF42912

webron
 
First a question - MYINTRANET_USERID was a parameter in HTTP_COOKIE (at least this is my understanding, and I am a baaaad web developer... so far :) and I needed to get its value, namely CF42912. Why did you choose MYINTRANET_USERID as a CF variable name? Hey, you can confuse me easily :) So it could have been
<cfset userID =listgetat(cgi,HTTP_COOKIE,2, &quot;=,;&quot;)>, right?

Second - I did try what you suggested and got the following error:

An error occurred while evaluating the expression:
MYINTRANET_USERID =listgetat(cgi,HTTP_COOKIE, 2, &quot;=,;&quot;)

Error near line 29, column 7.

Parameter 1 of function ListGetAt must be a basic value, i.e., a string, number, logical, or date/time value


webron - but even if this won't work - thanks for your input; I will sure find the use for the listgetat function later! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top