Read your data from $_COOKIE not $_COOKIES.
David Busby wrote:
> List,
> I'm trying to set a cookie like this:
> <?php
> function redirect() {
> if ($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_NAME']) {
> $to = func_get_arg(0);
> header("HTTP/1.1 301\n");
> header("Location:http://".$_SERVER['SERVER_NAME'].$to."\n");
> header("Set-Cookie: sid=$sid;\n\n");
> exit();
> }
> }
>
> function login() {
> [... validation code here ...]
> // set my cookie
> setcookie("sid", $sid);
> return true;
> }
>
> if (login($token) == true) {
> redirect("/somepage.php");
> }
> ?>
>
> but this thing isn't working...seems like it's not writing the SID value
> in the cookie. In other code (on /somepage.php for example) when I read
> the cookie value ($_COOKIES['sid']) it can't find it. Ideas?
>
> So how do I set cookies then redirect?
>
> I'm using Apache 1.3.x, PHP 4.1.2, RH7.3
>
> TIA
> /B
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php