[nycphp-talk] TCL, PHP and cookies - AUGH!
Phil Powell
soazine at erols.com
Thu Jul 31 13:28:59 EDT 2003
I have a TCL CGI script that has to verify if a cookie has been set. I have
no idea how in TCL a cookie can be read (I don't think there is a native TCL
process to do this), so I am trying to fudge it by scraping a PHP script I
wrote that does just that:
TCL:
set hasFoundCMACookie 0
set hasFoundCMACookie [string trim [COMPACT_HTML [HTTP_GET $env(SERVER_NAME)
80 /cma/get_cookie.php?junk=[RAND_STRING] {} {}]]]
PHP (get_cookie.php):
<html>
<head>
<meta http-equiv=Pragma content="No-cache">
</head>
<body>
<?
if (strtolower($HTTP_COOKIE_VARS["username"]) === "admin") {
echo '1';
} else {
echo '0';
}
?>
</body>
</html>
The TCL proc I wrote, HTTP_GET, works, it gets the contents of
get_cookie.php and returns them. However, it has constantly returned 0,
even if the cookie is found. If I go directly to get_cookie.php, I get the
correct value of 1 instead.
I'm absolutely stumped as to what to do. This sounds like another caching
issue on the part of get_cookie.php but I have no solution for it.
Thanx
Phil
More information about the talk
mailing list