Example #1
0
 /**
  * Devuelve un hash para verificación de formularios.
  * Esta función genera un hash que permite verificar la autenticidad de un formulario
  *
  * @param bool $new si es necesrio regenerar el hash
  * @return string con el hash de verificación
  */
 public static function getSessionKey($new = false)
 {
     $hash = sha1(time());
     // Generamos un nuevo hash si es necesario y lo guardamos en la sesión
     if (is_null(Session::getSecurityKey()) || $new === true) {
         Session::setSecurityKey($hash);
         return $hash;
     }
     return Session::getSecurityKey();
 }