$arFields["PERSONAL_PHONE"] = $phone; $arFields["EMAIL"] = $arFields["LOGIN"] = $phone . "@megatv.su"; $arFields["UF_PHONE_REG"] = "Y"; } $USER_ID = $user->Add($arFields); if (intval($USER_ID) > 0) { CUserEx::subcribeOnFreeChannels($USER_ID); $arFields["USER_ID"] = $USER_ID; $event = new CEvent(); $event->SendImmediate("NEW_USER", SITE_ID, $arFields); if (CDev::check_phone($phone)) { $checkword = mb_substr(md5(uniqid(rand(), true)), 0, 8); $cuser = new CUser(); $cuser->Update($USER_ID, array("UF_PHONE_CHECKWORD" => $checkword)); $text = GetMessage('AUTH_ACTIVATE_CODE_TEXT') . $checkword; CEchogroupSmsru::Send($phone, $text); $result['message'] = "<font style='color:green'>" . GetMessage('AUTH_REGISTER_SUCCESS_TEXT_1') . "</font><br />"; } else { //Для подтверждения регистрации перейдите по следующей ссылке: //http://#SERVER_NAME#/auth/index.php?confirm_registration=yes&confirm_user_id=#USER_ID#&confirm_code=#CONFIRM_CODE# $event->SendImmediate("NEW_USER_CONFIRM", SITE_ID, $arFields); //на почту письмо для подтверждения $result['message'] = "<font style='color:green'>" . GetMessage('AUTH_REGISTER_SUCCESS_TEXT_2') . "</font><br />"; CUserEx::capacityAdd($USER_ID, 1); // за мэйл +1ГБ } } $result['status'] = "success"; //Бонус за регистрацию CUserEx::capacityAdd($USER_ID, BONUS_FOR_REGISTRATION); COption::SetOptionString("main", "captcha_registration", "Y");
function TerminateSubscribe($arFields) { $saved_s = unserialize(COption::GetOptionString("echogroup.smsru", "SUBS")); if (in_array($arFields["ID"], $saved_s)) { global $USER; $uid = $USER->GetID(); if ($arFields["USER_ID"]) { $uid = $arFields["USER_ID"]; } if ($arFields["UID"]) { $uid = $arFields["UID"]; } if ($uid > 2) { $res = $USER->GetByID($uid); $arUser = $res->Fetch(); if (!$arUser["PERSONAL_PHONE"]) { $arUser["PERSONAL_PHONE"] = $arFields["TO"]; } foreach ($arFields as $k => $v) { $arForm["MESSAGE"] = str_replace("#" . $k . "#", $v, $arForm["MESSAGE"]); } CEchogroupSmsru::Send($arUser["PERSONAL_PHONE"], $arForm["MESSAGE"]); return false; } } }
</h1> <form method="post"> <?php if (strlen($_REQUEST["subscribe"]) > 0) { $address1 = explode("\n", $_REQUEST["phones"]); $address2 = $_REQUEST["users"]; $address = array_merge((array) $address1, (array) $address2); foreach ($address as $k => $v) { if (!preg_match("![0-9]*!", $v)) { unset($address[$k]); } else { $address[$k] = str_replace(" ", "", str_replace("(", "", str_replace(")", "", str_replace("+", "", $v)))); } } if (!empty($address) && $_REQUEST["mess"]) { echo CEchogroupSmsru::MultySend($address, $_REQUEST["mess"]); } } ?> <table> <tr><td><?php echo GetMessage("PHONE_LIST"); ?> </td><td><textarea name="phones"></textarea></td></tr> <tr><td><?php echo GetMessage("USERS"); ?> </td><td> <select name="users[]" multiple="multiple"><?php $res = CUser::GetList(); while ($r = $res->Fetch()) {