Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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 => '.blahblah.com'  
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.

SET COOKIE

use CGI::Cookie; my $c = new CGI::Cookie( -name => 'COOKIENAME', -value => 'Whosyerdaddy', -expires => '+1M', -domain => '.domain.com' ); print "Set-Cookie: $c\n";
READ COOKIES
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. :)

TOSS YOUR COOKIES
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
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.

    --Siddartha

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-12-29 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (192 votes), past polls