public function SetCodeCrypt($password = "") { if (!defined("CAPTCHA_COMPATIBILITY")) { return CCaptcha::SetCaptchaCode(); } $max = count($this->arChars); $this->code = ""; for ($i = 0; $i < $this->codeLength; $i++) { $this->code .= $this->arChars[rand(1, $max) - 1]; } if (!array_key_exists("CAPTCHA_PASSWORD", $_SESSION) || strlen($_SESSION["CAPTCHA_PASSWORD"]) <= 0) { $_SESSION["CAPTCHA_PASSWORD"] = randString(10); } $this->codeCrypt = $this->CryptData($this->code, "E", $_SESSION["CAPTCHA_PASSWORD"]); }