• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/captcha.php
  • Класс: CCaptcha
  • Вызов: CCaptcha::SetCode
function SetCode()
{
	if (!defined("CAPTCHA_COMPATIBILITY"))
	{
		CCaptcha::SetCaptchaCode();
		return;
	}

	$max = count($this->arChars);

	$this->code = "";
	for ($i = 0; $i < $this->codeLength; $i++)
		$this->code .= $this->arChars[rand(1, $max) - 1];

	$this->sid = time();

	if (!is_array(BitrixMainApplication::getInstance()->getSession()["CAPTCHA_CODE"]))
		BitrixMainApplication::getInstance()->getSession()["CAPTCHA_CODE"] = array();

	BitrixMainApplication::getInstance()->getSession()["CAPTCHA_CODE"][$this->sid] = $this->code;
}