public function initialize() { parent::initialize(); $login = $this->session->get('login'); $custom = $this->session->get('custom'); if ($login) { if (!$custom) { $user = $this->crypt->decrypt($login); $user = Custom::findfirst(array('name' => 'yunhai')); if (!$user->uname) { $this->forward('UserLogin/index'); } $this->session->set('custom', $user->database); } } else { return $this->forward('UserLogin/index'); } }