Weirdness with setcookie() (2nd time)

From: Date: Mon, 13 Nov 2000 17:26:49 +0000
Subject: Weirdness with setcookie() (2nd time)
Groups: php.general 
Request: Send a blank email to php-general+get-24987@lists.php.net to get a copy of this message
PS: I'm resending this as the first time nobody seemed to know the answer for this one.. === Hello all, I used to run a simple setcookie() code to create a cookie on a site back-end interface. It is the "administration" screens, and this lame code used to work on an old installment of PHP3.0.15 I think (not really sure the minor version, but definetely PHP3). This is a sample of the code I'm trying to run: <?php $lifetime = time() + 12000000; $encriptado = array( "username" => $strUsername, "permissoes" => $myrow["permissoes"], "hash" => md5($strUsername . $segredo) ); echo "<pre>\n"; print_r($encriptado); echo "</pre>\n"; $valor = serialize($encriptado); setcookie("musica_admin", $valor); include("admin.php"); ?> The array named $encriptado has stuff inside it, since print_r() prints the whole structure with no problems. I already tried setting the expire time to a really big number, and already tried setting both the path parameter and the domain parameter (With the 2 dots ".domain.com"). Nothing like this mattered, as the cookie keeps being empty. I already tried using header("Location: admin.php"); by the way and nothing. This is the way it was supposed to work: index.php -> file with the login form. login.php -> file with the whole login checking, it creates the cookie admin.php -> frameset with 2 scripts that then checks for the cookie So, index.php calls login.php for the login checking, going to the database and stuff, and if everything is okay, it redirects or includes the admin.php file. The cookie is always empty no matter what. This exact same code used to work perfectly for PHP3. Actually the same exact code work in a Solaris box running PHP4.0.3pl1. Another hint, this same site has another section that uses cookies and in that section the cookie _does_ get set correctly. Only on this back-end interface is that the problem happens. If anybody has any ideas on this issue, it would help a lot as I'm getting crazy here :) Joao -- Joao Prado Maia Web Developer Kefta, Inc. T: (415) 391-6881 ext 8008 F: (415) 391-7079

« previous php.general (#24987) next »