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

From: Date: Tue, 14 Nov 2000 00:32:40 +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-25068@lists.php.net to get a copy of this message
Make sure you pass all options to setcookie that you require: int setcookie (string name [, string value [, int expire [, string path [,string domain [, int secure]]]]]) If you want it to not be a session cookie, you have to set an expire time. You may also want to set a path, and a domain (remember, the leading period -- .mydomain.com). -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 16:27:49 -0800 (PST) > From: Joao Prado Maia <jmaia@kefta.com> > 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 > >

« previous php.general (#25068) next »