perlknight has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl # example_5-1.cgi use strict; print qq(Content-type: text/html\n"); print qq(Set-Cookies: username=Fred Flinstone; ); print qq(expires=Mon, 01-May-2003 00:00:00 GMT; ); print qq(path=/); print qq(\n\n); print qq(A cookie has been set in your browser...<P>); print qq(<A HREF="example_5-2.cgi">); print qq(Click to view the cookie</A>);
here's the code that checks if the cookie is set:
#!/usr/bin/perl #example_5-2.cgi use strict; my ($key,$value) = split(/=/,$ENV{HTTP_COOKIE}); print qq(Content-type: text/html\n\n); print qq(The cookie <B>$key</B> contained <B>$value</B>);
When I call the code via my browser: http://localhost/cgi-bin/play/example_5-1.cgi this sets the cookie and http://localhost/cgi-bin/play/example_5-2.cgi this displays it, but the cookie is not displaying. I even check Konqueror for the cookie, but there's nothing there from localhost. Does any one see anything wrong with this? Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cookie problem
by mattriff (Chaplain) on Apr 28, 2002 at 16:47 UTC | |
by growlf (Pilgrim) on Apr 28, 2002 at 17:33 UTC | |
by perlknight (Pilgrim) on Apr 28, 2002 at 23:05 UTC | |
|
Re: cookie problem
by giulienk (Curate) on Apr 28, 2002 at 17:13 UTC | |
by perlknight (Pilgrim) on Apr 28, 2002 at 23:03 UTC | |
|
Re: cookie problem
by Chady (Priest) on Apr 28, 2002 at 16:31 UTC | |
by Kozz (Friar) on Apr 28, 2002 at 16:43 UTC | |
|
Re: cookie problem
by growlf (Pilgrim) on Apr 28, 2002 at 16:58 UTC | |
|
Re: (newrisedesigns) cookie problem
by newrisedesigns (Curate) on Apr 29, 2002 at 03:04 UTC | |
|
Re: cookie problem
by perlknight (Pilgrim) on Apr 29, 2002 at 15:43 UTC | |
by Kozz (Friar) on Apr 29, 2002 at 20:25 UTC |