Re: Weirdness with setcookie() (3rd time - come on people :)
| From: | Joao Prado Maia | Date: | Tue, 14 Nov 2000 01:30:56 +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-25080@lists.php.net to get a copy of this message | ||
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