Ayudante Sessions
De ZanPHP
core/helpers/sessions.security.php
El Ayudante Sessions contiene funciones relacionadas con Variables de Sesión y Cookies.
Cargando este Asistente
Este asistente es cargado usando el siguiente código:
$this->helper("sessions");
Las siguientes funciones están disponibles:
unsetCookie(string $cookie, string $URL = _webBase)
Retorna: @void;
Elimina una Cookie. Ejemplo:
$URL = "www.mydomain.com" unsetCookie("foo", $URL); //Unset the $_COOKIE["foo"] and redirects to www.mydomain.com //It must be include the Security helper
unsetSession(string $URL = _webBase)
Retorna: @void;
Esta función remueve todas las variables de sesión. Ejemplo:
$URL = "www.mydomain.com" unsetSessions($URL); //Unset all session variables and redirects to www.mydomain.com //It must be include the Security helper
createCookie(string $cookie, string $value, bool $redirect = FALSE, string $URL = _webBase, int $time = 604800)
Retorna: @mixed;
Esta función crea una Cookie. Ejemplo:
createCookie("my_cookie", "foo", TRUE, "www.mydomain.com", 3600); //Creates cookie: "my_cookie", with the string value: "foo", redirects to www.mydomain.com and set the live of the cookie in 1 hour //It must be include the Security helper
createSession(string $session = NULL, string $value = NULL, bool $redirect = FALSE, string $URL = _webBase)
Retorna: @mixed;
Esta función crea una variable de sesión. Ejemplo:
createSession("foo", "bar", TRUE, "www.mydomain.com"); //Sets variable session: "foo", with the string value: "bar" and redirects to www.mydomain.com //It must be include the Security helper
SESSION(string $session)
Retorna: @mixed;
Esta función devuelve el valor de una variable de sesión. Ejemplo:
$_SESSION["foo"] = "bar"; //Assuming "foo" is a $_SESSION variable and it is set. SESSION("foo"); //output: "bar"