• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/captcha.php
  • Класс: CCaptcha
  • Вызов: CCaptcha::SetCaptchaCode
function SetCaptchaCode($sid = false)
{
	$max = count($this->arChars);

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

	$this->sid = $sid===false? $this->Generate32RandomString(): $sid;

	CCaptcha::Add(
		Array(
			"CODE" => $this->code,
			"ID" => $this->sid
		)
	);

}