Bill Platt wrote:

> I have set up the following code for the purpose of
> putting a cookie on my site:
> 
> $Cookie_html = "Set-Cookie: latc_affid='$cookie_data';
> expires='$CookieExpires'; path=$CookiePath; domain=$CookieDomain;
> $CookieSecure\n";

What's in those vrbls ?

> print "Content-type: text/html\n\n$Cookie_html\n\n";
> 
> 
> This does not work. I have tried many variations to
> execute a cookie placement on my system, and so
> far I have struck out on dozens of runs.
> 
> I have attempted putting the Cookie_html code in
> front of the Content-type code as was suggested
> on a couple of sites. This causes the whole page
> to print in plain text.
> 
> I have attempted using a single \n after the
> Content-type, even single \n after the Cookie_html
> variable. After each attempt, I return to the \n\n
> and still see zero results.
> 
> I am watching my IE cookie folder to find the cookie,
> and I have even attempted loading the found cookie
> to my browser window. Both show no cookie.
> 
> Is there anyone available that could advise me in
> getting this to work correctly?

Thry this one (run it once and then again to see if the cookie is set :

use strict;
use warnings;

my $cookie_data = 'data';
my $CookieExpires = 'Wed, 29-Dec-2010 00:00:00 GMT';
my $CookiePath = '/';
my $CookieDomain = '';
my $CookieSecure = '';

print "Set-Cookie: latc_affid=$cookie_data; " .
  "expires=$CookieExpires; path=$CookiePath; domain=$CookieDomain; " .
  "$CookieSecure\n";
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<BODY>\n";
print "<BR>Cookies set:\n";
if ($ENV{'HTTP_COOKIE'}) {
        print "<PRE>\n";
        foreach (split (/;\s*/, $ENV{'HTTP_COOKIE'})) {
                # Split the cookie name and value pairs
                my ($name, $value) = split (/=/);
                print "$name = $value\n";
        }
        print "</PRE>\n";
}
print "</BODY>\n";
print "</HTML>\n";
exit;
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to