cookie

cookie is my adaptation of the normal PHP cookies but encrypted. This class just makes it easier for me to work with. Basically you decide on a name for the cookie by using the cookie.name setting, then store whatever data you want and it will be set on the user’s machine.

Example:

Parent Class

None


Static Properties

$contents
This associative array contains all the keys and their values. You really should not access this variable directly, but instead use the various functions that expose it.
Data Type: array
Default Value: Empty array

Static Methods

void add( string $key, mixed $value )
Add a $value to the cookie and associate it with the $key
Parameters:
$key (string) name of key you will use to retrieve the data you are storing
$value (mixed) the value of any type you want to store in the cookie
Returns:
null
Example:
void drop( string $key )
Drop a $value associated with the $key from the cookie
Parameters:
$key (string) name of key you want to remove
Returns:
null
Example:
bool keyExists( string $key )
Tests to see if the $key exists or not
Parameters:
$key (string) name of key you want to locate
Returns:
bool – True if the key exists, otherwise false.
Example:
mixed keyValue( string $key )
Tests to see if the $key exists or not
Parameters:
$key (string) name of key you want to locate
Returns:
The $value associated with the $key or null if the $key does not exist.
Example:
void clear()
Deleted all data from the cookie
Parameters:
None
Returns:
null
Example:
void debug( string $suffix )
Occasionally it’s easier to put some additional information in the headers being sent back to the user, for debugging, etc.
Parameters:
$suffix (string) is an optional string that help identify your application
Returns:
null
void set()
This function handles the actual cookie string that will be sent to the user. You really should not have a need to call this function directly since iPinga calls it once during the handleShutdown() function. If the cookie is empty, then this function handles removing the cookie from the user’s machine.
Parameters:
None.
Returns:
null
mixed decrypt( string $encryptedString )
Easy way see what a cookie has in it
Parameters:
$encryptedString is a json encoded and encrypted string that is the value for the cookie as it appears on the user’s machine
Returns:
mixed