Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: SSI and *reading* a cookie only

by jfrm (Monk)
on Jun 20, 2005 at 12:24 UTC ( [id://468305]=note: print w/replies, xml ) Need Help??


in reply to SSI and *reading* a cookie only

I have read that the SSI script cannot use the cookie environment variable because the server runs the script without reference to the incoming cookie. In fact, I think I've verified this because I've tried to use it in my SSI and it took me a long time to work out why my script wasn't working. (I don't fully understand why this should be so - the cookie is sent to the server and so I would have thought that there ought to be a way for the SSI script to use what the server already knows).

OK, I've sussed this now. Although I read in 2 places on websites that you cannot set OR read a cookie within SSI, this has turned out to be false. You cannot set a cookie but you CAN read one quite happily. I am now doing it on my website. q.v. change currency functionality in the price tables on pages on www.mastersgames.com

For the record and in case this happens to anyone else, my error occurred when I was setting the cookie - I did not specify the path variable. Therefore it defaulted to "/cgi-bin", the location of the script doing the setting. Since my normal web pages are not in cgi-bin, the cookie was not passed to them when the browser requested a normal page.

As soon as I set the path variable to be explicitly "/", the cookie environment variable was available within the page and also within SSIs within that page.

A still pitiful but much less desperate monk.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://468305]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found