Пример #1
0
 /**
  * Extends the session cookie lifetime period
  */
 public function extendCookie($expire = null)
 {
     $time = time();
     $default = $time + $this->getOption("cookie_lifetime", 0);
     $expire = Utils::value(Sanitize::toTimestamp($expire), $default);
     if ($expire > $time) {
         return setcookie(session_name(), session_id(), $expire, $this->getOption("cookie_path"), $this->getOption("cookie_domain"), $this->getOption("cookie_secure"), $this->getOption("cookie_httponly"));
     }
     return false;
 }
Пример #2
0
 /**
  * Sets the Strict-Transport-Security header for a timestamp
  */
 public function rememberSsl($value = null)
 {
     $time = Sanitize::toTimestamp($value);
     if (!empty($time)) {
         $now = time();
         $secs = $time > $now ? $time - $now : 0 - ($now - $time);
         $this->setHeader("Strict-Transport-Security", "max-age=" . $secs . "; includeSubDomains");
     }
     return $this;
 }