require_once($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
if($_REQUEST["name"] && $_REQUEST["email"]) {
global $USER;
CModule::IncludeModule("main");
$name = htmlspecialcharsEx($_REQUEST["name"]);
$email = htmlspecialcharsEx($_REQUEST["email"]);
$chars="qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP";
$max=10;
$size=StrLen($chars)-1;
$password=null;
while($max--)
$password.=$chars[rand(0,$size)];
$user = new CUser;
$arFields = Array(
"NAME" => $name,
"EMAIL" => $email,
"LOGIN" => $email,
"ACTIVE" => "N",
"GROUP_ID" => 3,
"PASSWORD" => $password,
"CONFIRM_PASSWORD" => $password
);
$ID = $user->Add($arFields);
if(intval($ID) > 0))
{
$arEventFields = array(
"ID" => $ID,
"NAME" => $name,
"EMAIL" => $email,
"PASS" => $password
);
CEvent::Send("TOURIST_REG", "s1", $arEventFields);
LocalRedirect($_REQUEST["page"]."?reg=yes");
}
} |