find('username=:username', array('username'=>$this->username)); if ($admin === null) { $this->errorCode=self::ERROR_USERNAME_INVALID; return false; } if (crypt($this->password, $admin->password) == $admin->password) { $this->errorCode=self::ERROR_NONE; return true; } $this->errorCode=self::ERROR_PASSWORD_INVALID; return false; } }