p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Cookie access


Message #1 by "Christopher Brown" <chris@k...> on Thu, 6 Feb 2003 23:50:23
I can write a cookie, but now I want to read from one and check its
existence.  I'm not sure that my previous attempts read the value from the
cookie.

Basically I want to do this:
-----------------------------------
If cookie fgostatus exist{
	if $usr==username and $pass==microsoft{
-----------------------------------
where $usr and $pass are read from the cookie.
Message #2 by "Nikolai Devereaux" <yomama@u...> on Thu, 6 Feb 2003 15:50:05 -0800
> I can write a cookie, but now I want to read from one and check its
> existence.  I'm not sure that my previous attempts read the value from the
> cookie.
>
> Basically I want to do this:
> -----------------------------------
> If cookie fgostatus exist{
> 	if $usr==username and $pass==microsoft{
> -----------------------------------
> where $usr and $pass are read from the cookie.


Have you read any part of the PHP manual?  This is pretty straight forward
stuff.

http://www.php.net/manual/en/function.setcookie.php


if(isset($_COOKIE['fgostatus']))
{
   if (($_COOKIE['usr']  == 'username') &&
       ($_COOKIE['pass'] == 'password'))
   {
      do stuff
   }
}


Take care,

nik


  Return to Index