RE: [PHP] Weirdness with setcookie() (3rd time - come on people :)

From: Date: Tue, 14 Nov 2000 00:42:22 +0000
Subject: RE: [PHP] Weirdness with setcookie() (3rd time - come on people :)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25071@lists.php.net to get a copy of this message
I ran into something like this in the summer with an early version of PHP4. It seemed that the setcookie() function would work sometimes but not others. I found that it worked consistently by just setting it using the header() function to send a cookie header. Might be a bug but I didn't have time to really track it down so I didn't feel like messing with it. By the way, I was running RedHat 6.2/Apache/PHP static mod. That's probably not what you wanted to hear but I figure it's better than getting no response at all... Jason -----Original Message----- From: Joao Prado Maia [mailto:jmaia@kefta.com] Sent: Monday, November 13, 2000 5:28 PM To: php-general@lists.php.net Subject: [PHP] Weirdness with setcookie() (3rd time - come on people :) PS: I'm resending this, since the first and second times nobody seemed to know the answer for this one. Actually no replies.. === 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net _______________________________________________________ Site Design, Hosting, and E-Commerce at www.webpipe.net

« previous php.general (#25071) next »