Пример #1
0
 /**
  * Used to check for a valid session.
  *
  * In your controller: $this->Session->valid();
  *
  * @return boolean true is session is valid, false is session is invalid
  * @access public
  */
 function valid()
 {
     if ($this->__active === true) {
         $this->__start();
         return parent::valid();
     }
     return false;
 }
 /**
  * Returns true if session is valid.
  *
  * @return bool Success
  */
 public static function valid()
 {
     if (self::start() && self::read('Config')) {
         if (self::_validAgentAndTime() && self::$error === false) {
             self::$valid = true;
         } else {
             self::$valid = false;
             self::_setError(1, 'Session Highjacking Attempted !!!');
         }
     }
     return self::$valid;
 }
 /**
  * Used to check is a session is valid in a view
  *
  * @return bool
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#SessionHelper::valid
  */
 public function valid()
 {
     return CakeSession::valid();
 }
Пример #4
0
 /**
  * Used to check is a session is valid in a view
  *
  * @return boolean
  * @access public
  */
 function valid()
 {
     if ($this->__active === true && $this->__start()) {
         return parent::valid();
     }
 }
Пример #5
0
 /**
  * Helper method to create a new session.
  *
  * @return void
  */
 protected static function _checkValid()
 {
     if (!self::started() && !self::start()) {
         self::$valid = false;
         return false;
     }
     if ($config = self::read('Config')) {
         $sessionConfig = Configure::read('Session');
         if (self::_validAgentAndTime()) {
             self::write('Config.time', self::$sessionTime);
             if (isset($sessionConfig['autoRegenerate']) && $sessionConfig['autoRegenerate'] === true) {
                 $check = $config['countdown'];
                 $check -= 1;
                 self::write('Config.countdown', $check);
                 if ($check < 1) {
                     self::renew();
                     self::write('Config.countdown', self::$requestCountdown);
                 }
             }
             self::$valid = true;
         } else {
             self::destroy();
             self::$valid = false;
             self::_setError(1, 'Session Highjacking Attempted !!!');
         }
     } else {
         self::write('Config.userAgent', self::$_userAgent);
         self::write('Config.time', self::$sessionTime);
         self::write('Config.countdown', self::$requestCountdown);
         self::$valid = true;
     }
 }
Пример #6
0
 /**
  * Used to check is a session is valid in a view
  *
  * @return boolean
  * @access public
  */
 function valid()
 {
     if ($this->__active === true) {
         return parent::valid();
     }
 }