Parse the HTTP_COOKIES string from Apache for use in #if clause
Posted
by Ambrose
on Stack Overflow
See other posts from Stack Overflow
or by Ambrose
Published on 2009-06-02T07:03:13Z
Indexed on
2010/03/30
9:03 UTC
Read the original article
Hit count: 518
I want to be able to read the cookies from Apache's HTTP_COOKIE string and then add includes based on the contents of that string.
I've got this far:
<!--#set var="cookies" value="HTTP_COOKIE" -->
<p>COOKIES: <!--#echo var="$cookies"--></p>
which gives me a string with all the cookies in it.
Now I want to be able to parse the string for something like Name=Bob
.
I thought I'd be able to do this:
<!--#if expr="$cookies = /Name=([a-zA-Z]+)/"-->
<p>Your name is <!--#echo var="$1"--></p>
<!--#endif-->
But it doesn't seem to work. What should I be doing -- or isn't this possible?
© Stack Overflow or respective owner