Exemplo n.º 1
0
 /**
  * Saves a new cookie value
  */
 public function save($value = null, $expire = null, $encrypt = false)
 {
     if (!empty($this->_name)) {
         $value = Sanitize::toString($value);
         $expire = Sanitize::toTime($expire);
         if ($encrypt === true) {
             $value = $this->encrypt($value);
         }
         return setcookie($this->_name, $value, $expire, $this->_path, $this->_domain, $this->_secure, $this->_http);
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Extends the session cookie lifetime period
  */
 public function extendCookie($expire = null)
 {
     $time = time();
     $default = $time + $this->getOption('cookie_lifetime', 0);
     $expire = Utils::getValue(Sanitize::toTime($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;
 }