Re: Getting info from Cookie
| From: | Jason Wong | Date: | Wed, 15 Aug 2001 17:54:55 +0000 |
| Subject: | Re: Getting info from Cookie | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11395@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: Cato Larsen <ravenno1@world-online.no>
To: <php-db@lists.php.net>
Sent: Wednesday, August 15, 2001 9:03 PM
Subject: Re: [PHP-DB] Getting info from Cookie
> Thanks!
> But how do you extract a certain point of info from it?
>
> The info is seperated by "+" (without the "'s)
>
> I used:
> <?php echo $HTTP_COOKIE_VARS["TestCookie"]; ?>
>
> And I got Cato+bec39d1ca1091da20b4a8ef5ecacfde8
>
> Where bec39d1ca1091da20b4a8ef5ecacfde8 is the session id for the MySQL
> database, and Cato is what I want to extract.
Use explode() to split the string using "+". This returns an array with 2
elements and in your case you want the first element.
$parts = explode("+", $HTTP_COOKIE_VARS["TestCookie"]);
echo $parts[0]
regards
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk