Subject: | Cookies from domain are not read. |
If you have a file that is parsed with CGI::SSI any cookies that are stored in the users browser are not passed to any scripts/includes that are within the parsed file.
Example:
A cookie named: 'mycookie' (value 'John Doe') is set for '.mydomain.com' (path is '/', not secure, expires in a hour). Script will always print 'Stranger' by error.
A parsed file includes the includes:
Hello
<!--#include virtual="cgi-bin/printcookie.cgi"-->
,<BR>How are you.
printcookie.cgi:
use CGI::Cookie;
print "Content-type: text/html\n\n";
print GetCookie('mycookie');
sub GetCookie{
my($CookieName)=$_[0];
my($Data) = 'Stranger';
my(%cookies) = fetch CGI::Cookie;
foreach (keys %cookies) {
if($cookies{$CookieName}){
$Data = $cookies{$CookieName}->value;
last;
}
}
return $Data;
}