[PHP] Cookie Not Setting..
Ok, I've used cookies before and have never had a problem with them but for some reason this doesn't seem to be setting! Here is the start of the file called after logging in to my site. In another file I have echo $wwblCookie and have also tried echo $HTTP_COOKIE_VARS["wwblCookie"] but no luck.
Re: [PHP] Cookie Not Setting..
Actually, nevermind. I got it. I was calling a function and sent the variable with the function so it worked :) - Original Message - From: "Jeff Lewis" <[EMAIL PROTECTED]> To: "Magnus Hammar" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, July 11, 2001 9:38 AM Subject: Re: [PHP] Cookie Not Setting.. > Still no luck. Do I have to read a cookie before any HTML is sent as well? > I know to set it before it is sent but reading? > > Jeff > - Original Message - > From: "Magnus Hammar" <[EMAIL PROTECTED]> > To: "Jeff Lewis" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, July 11, 2001 9:30 AM > Subject: Re: [PHP] Cookie Not Setting.. > > > > Try this: > > > > $cookie_name= "wwblCookie"; > > $value = "PLEASE"; > > $exp= time() + (86400 * 365); > > $server = "www.domain.com"; // Or IP-address will also do fine > > // the domain must cuntain three "." > > // as in ".somedomain.com" > > $secure = 0; > > setcookie($cookie_name, $value, $exp, "/", $server,$secure); > > > > > > /Magnus Hammar > > -- > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Cookie Not Setting..
Some things to keep in mind: 1. The cookie can't be read untill the next time you access a page. 2. The cookie can only be red in the same level as it is set (I guess), that means that if you set a cookie in "/my/pages/index.php" you can't read the cookie from a page in "/my/index.php". 3. To really see if the cookie is set you can use Netscape and let it warn you before accepting a cookie, in that way you will see the cookiename and it's value and then you can be sure the cookie is set. 4. You can do the same thing with IE. /Magnus Hammar - The cookiemonster? =) -- > Still no luck. Do I have to read a cookie before any HTML is sent as well? > I know to set it before it is sent but reading? > > Jeff > - Original Message - > From: "Magnus Hammar" <[EMAIL PROTECTED]> > To: "Jeff Lewis" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, July 11, 2001 9:30 AM > Subject: Re: [PHP] Cookie Not Setting.. > > >> Try this: >> >> $cookie_name= "wwblCookie"; >> $value = "PLEASE"; >> $exp= time() + (86400 * 365); >> $server = "www.domain.com"; // Or IP-address will also do fine >> // the domain must cuntain three "." >> // as in ".somedomain.com" >> $secure = 0; >> setcookie($cookie_name, $value, $exp, "/", $server,$secure); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]