The stupid question is the question not asked | |
PerlMonks |
Re: SSI and *reading* a cookie onlyby jfrm (Monk) |
on Jun 20, 2005 at 12:24 UTC ( [id://468305]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|