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:
1 2 3 4 5 |
$iPinga = new \ipinga\ipinga(); \ipinga\cookie::add('my_variable','some value here'); \ipinga\cookie::set(); // actually sets it on the user's machine (only call this once!) |
Parent Class
None
Static Properties
Data Type: array
Default Value: Empty array
Static Methods
$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:
1 2 3 4 5 |
$iPinga = new \ipinga\ipinga(); \ipinga\cookie::add('my_variable','some value here'); \ipinga\cookie::set(); // actually sets it on the user's machine (only call this once!) |
$value
associated with the $key
from the cookie
Parameters:
$key
(string) name of key you want to removeReturns:
null
Example:
1 2 3 4 5 |
$iPinga = new \ipinga\ipinga(); \iPinga\cookie::drop('my_variable'); \ipinga\cookie::set(); // actually sets it on the user's machine (only call this once!) |
$key
exists or notParameters:
$key
(string) name of key you want to locateReturns:
bool – True if the key exists, otherwise false.
Example:
1 2 3 4 5 |
$iPinga = new \ipinga\ipinga(); \ipinga\cookie::add('my_variable','my value); echo \ipinga\cookie::keyExists('my_variable'); // outputs TRUE |
$key
exists or notParameters:
$key
(string) name of key you want to locateReturns:
The
$value
associated with the $key
or null if the $key
does not exist.Example:
1 2 3 4 5 |
$iPinga = new \ipinga\ipinga(); \ipinga\cookie::add('my_variable','my value); echo \ipinga\cookie::keyValue('my_variable'); // outputs "my value" |
cookie
Parameters:
None
Returns:
null
Example:
1 2 3 4 5 6 7 |
$iPinga = new \ipinga\ipinga(); \ipinga\cookie::add('my_variable','my value); echo \ipinga\cookie::keyExists('my_variable'); // outputs TRUE \ipinga\cookie::clear(); echo \ipinga\cookie::keyExists('my_variable'); // outputs null |
Parameters:
$suffix (string) is an optional string that help identify your application
Returns:
null
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
Parameters:
$encryptedString
is a json encoded and encrypted string that is the value for the cookie
as it appears on the user’s machineReturns:
mixed