Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: The cookie crumbles

by joealba (Hermit)
on Oct 24, 2001 at 16:29 UTC ( #121087=note: print w/ replies, xml ) Need Help??

in reply to The cookie crumbles

First: Change your -domain line to:

     -domain => ''  
You need at least two periods in the domain line (to make sure you don't try to set a domain-wide cookie across a top level domain like .com or something).

Second: I prefer to use CGI::Cookie. I've never had a problem with it.


use CGI::Cookie; my $c = new CGI::Cookie( -name => 'COOKIENAME', -value => 'Whosyerdaddy', -expires => '+1M', -domain => '' ); print "Set-Cookie: $c\n";
my %temp = parse CGI::Cookie($ENV{HTTP_COOKIE}); my %cookies; foreach (keys %temp) { $cookies{$_} = shift @{$temp{$_}{value}}; }
I'm not sure why parse returns an array of values for each cookie, but it does. Yes, I could have used map, but I haven't had my coffee yet this morning. :)

print header(); my $debug = 1; # READ COOKIE CODE if ($debug) { foreach (keys %cookies) { print "$_: $cookies{$_}<BR>\n"; } }
Redirect to a simple little script that runs this code. That should tell you how well your cookies worked.

Comment on Re: The cookie crumbles
Select or Download Code
Replies are listed 'Best First'.
Re: Re: The cookie crumbles
by Siddartha (Curate) on Oct 24, 2001 at 17:18 UTC
    Thanks for the info.

    I have solved the problem though. With the general admin on the servers, the server suddenly decided it was 1970 instead of 2001. this is why all my cookies were being killed.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://121087]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-11-28 14:58 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (742 votes), past polls