RE: [PHP] Cookie Retrieval
| From: | Johnson, Kirk | Date: | Tue, 11 Dec 2001 23:09:51 +0000 |
| Subject: | RE: [PHP] Cookie Retrieval | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77373@lists.php.net to get a copy of this message | ||
I think this approach should work as long as register_globals is set to 'on'
in php.ini. If it isn't, then reference the cookie as
$HTTP_COOKIE_VARS['poccd_session'].
Kirk
> 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