Re: Weirdness with setcookie() (3rd time - come on people :)

From: Date: Tue, 14 Nov 2000 01:33:53 +0000
Subject: Re: Weirdness with setcookie() (3rd time - come on people :)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25082@lists.php.net to get a copy of this message
Joao, Two thoughts... 1) Maybe the data exceeds the limit that is stored in a cookie. 2) is .domain.com (I know this is your example) a correct domain for where you are trying to set the cookie from? (well, maybe 3, does your browser suck? I mean can you set cookies to it with other scripts?) That's all I can think of. -jeremy brand http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more --------------------------------------------------------------------- We cannot do everything at once, but we can do something at once. -- Calvin Coolidge On Mon, 13 Nov 2000, Joao Prado Maia wrote: > Date: Mon, 13 Nov 2000 17:30:56 -0800 (PST) > From: Joao Prado Maia <jmaia@kefta.com> > To: jeremy brand <jeremy@nirvani.net> > Cc: Joao Prado Maia <jmaia@kefta.com>, php-general@lists.php.net > Subject: Re: [PHP] Weirdness with setcookie() (3rd time - come on people :) > > > On Mon, 13 Nov 2000, jeremy brand wrote: > > > Joao, > > > > Well, maybe I'm still not understanding the problem. The cookie isn't > > available until the page after the page that sets the cookie. If you > > are trying to print them in the same script, of course they won't be > > available. > > Okay, let me explain a little further. Here is what I'm trying to do with > this setcookie() call: > > <?php > $hash = md5($username . $secret_word); > $values = array( > "username" => "test", > "permissions" => "AerFG", > "hash" => $hash > ); > setcookie("admin_cookie", serialize($values), time() + 12000000, > "/admin/", ".domain.com", 0); > header("Location: another_file.php"); > ?> > > Again, this doesn't work, but the page is redirected. I also already tried > include()'ing the "another_file.php" instead of redirecting, but still the > same problem. > > Now, if I try to print_r($values); in that little snipplet before settting > the cookie, it shows up all the contents of the array with no problems, > but on the next script, "another_file.php", the cookie is just not > created. > > I hope this can clear things up. Thanks for your help. > Joao > > -- > Joao Prado Maia > Web Developer > Kefta, Inc. > T: (415) 391-6881 ext 8008 > F: (415) 391-7079 > >

« previous php.general (#25082) next »