Re: Cookie Retrieval
| From: | Chris Lee | Date: | Tue, 18 Dec 2001 17:27:24 +0000 |
| Subject: | Re: Cookie Retrieval | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78092@lists.php.net to get a copy of this message | ||
I know this isnt answering your question, but skip cookies and goto
sessions, easier to work with.
now the answer to your question, you need to set the domain and path on your
setcookie()
setcookie('name', 'value', $exp, '/', $SERVER_NAME);
--
Chris Lee
lee@mediawaveonline.com
"Steve Osborne" <s.osborne@chinookmultimedia.com> wrote in message
news:001701c1829d$90a519a0$6e00a8c0@chinook.ualberta.com...
> Can someone tell me if there is a bit of code I need to put on pages so I
> can retrieve a cookie.
> The cookie was set with the following code:
>
> //(D) Set Cookie
> $encoded_login = encode_string($login);
> if ( $remember == "yes" ){
> // set login to expire in 1000 days
> $time = (time() + ( 24 * 3600 * 365 ));
> SetCookie ( "poccd_session", $encoded_login, $time);
> }else{
> SetCookie ( "poccd_session", $encoded_login );
> }
>
> I am trying to retrieve it with the following code (for testing purposes
> only, right now):
>
> if($poccd_session)
> {
> header("location: index.php");
> }else{
> print("The cookie plan didn't work.....");
> }
>
> Any suggestions would be appreciated.
>
> Steve Osborne
> Database Programmer
> Chinook Multimedia Inc.
> s.osborne@chinookmultimedia.com
>