Esempio n. 1
0
function unauthCodeSMS($code)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sms_gate_a1.php';
    $objResponse = new xajaxResponse();
    $uid = get_uid();
    $reqv = sbr_meta::getUserReqvs($uid);
    $ureqv = $reqv[$reqv['form_type']];
    $sms_gate = new sms_gate_a1($ureqv['mob_phone']);
    $info = $sms_gate->getInfoSend();
    if ($info['data'] == $code) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        $user = new users();
        sbr_meta::authMobPhone($uid, false);
        sbr_meta::safetyMobPhone($uid, false);
        $user->updateSafetyPhone($uid, false);
        $html = '<a href="javascript:void(0)" class="b-button b-button_rectangle_color_transparent b-button_margtop_-2" data-send="safety"><span class="b-button__b1"><span class="b-button__b2"><span class="b-button__txt">Активировать</span></span></span></a>';
        if ($_SESSION['is_verify'] != 't') {
            $mobphone = "\$('safety_mob_phone').removeClass('b-combo__input_disabled'); \$('safety_mob_phone').getElement('input').set('disabled', false);";
        } else {
            $mobphone = '';
        }
        $objResponse->script("\$('auth_popup').set('html', '').hide();\n                              \$\$('.c_sms_main').set('html', '{$html}');\n                              \$\$('.safety_phone_checks').each( function(el) {\n                                  \$(el).getElements('input[type=checkbox]').set('disabled', true).set('checked', false);\n                              });\n                              {$mobphone}\n                              \$('safety_status').set('html', 'выключена');\n                              \$('safety_status').addClass('b-layout__txt_color_c10600').removeClass('b-layout__txt_color_6bb336');\n                              bindLinkActivateAuth();\n                              ");
        return $objResponse;
    }
}
Esempio n. 2
0
         $o_only_phone = $only_phone;
         $reqv['is_safety_mob'] = $finance_safety_phone;
         $user->updateSafetyPhone($uid, $only_phone == 't' ? true : false);
         sbr_meta::safetyMobPhone($uid, $finance_safety_phone == 't' ? true : false);
         unset($_SESSION['send_sms_code'], $_SESSION['send_sms_phone']);
     } elseif ($o_only_phone == 't' && $o_only_phone != $only_phone || $reqv['is_safety_mob'] == 't' && $reqv['is_safety_mob'] != $finance_safety_phone) {
         $error_phone['code'] = true;
     }
     // Включение, без проверки СМС
     if ($o_only_phone == 'f' && $only_phone == 't' && !$safety_complete) {
         $o_only_phone = 't';
         $user->updateSafetyPhone($uid, true);
     }
     if ($reqv['is_safety_mob'] == 'f' && $finance_safety_phone == 't' && !$safety_complete) {
         $reqv['is_safety_mob'] = 't';
         sbr_meta::safetyMobPhone($uid, true);
     }
     break;
 case "safety_update":
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr_meta.php';
     $reqv = sbr_meta::getUserReqvs(get_uid(false));
     $ureqv = $reqv[$reqv['form_type']];
     $ip_addresses = change_q(trim(stripslashes($_POST['ip_addresses'])), true);
     $bind_ip = $_POST['bind_ip'];
     if ($bind_ip != 't') {
         $bind_ip = 'f';
     }
     $password = trim(stripslashes($_POST['password']));
     $error_flag = 0;
     $frl = new users();
     // Проверям IP
Esempio n. 3
0
/**
 * Изменить данные привязки аккаунта к телефону.
 * 
 * @param int    $sUid       UID пользователя
 * @param string $sPhone     телефон
 * @param string $sPhoneOnly отправлять восстановление пароля только на телефон - 't' или 'f'
 * @param string $sSafetyMob Входить в финансы только по СМС - 't' или 'f'
 *
 * @return object xajaxResponse
 */
function updateSafetyPhone($sUid = 0, $sPhone = '', $sPhoneOnly = 'f', $sSafetyMob = 'f')
{
    session_start();
    $objResponse = new xajaxResponse();
    if (hasPermissions('users')) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
        $sPhone = '+' . str_replace('+', '', $sPhone);
        $reqv = sbr_meta::getUserReqvs($sUid);
        if ($reqv[$reqv['form_type']]['mob_phone'] != $sPhone) {
            $nreqv['mob_phone'] = $sPhone;
            $cnt = 0;
            $filter = array('search_phone_exact' => true, 'search_phone' => $nreqv['mob_phone']);
            sbr_meta::searchUsersPhone($cnt, $filter);
            if ($cnt > 0) {
                $res = "Телефон {$sPhone} уже зарегистрирован в системе.";
                $objResponse->assign("safety_phone{$sUid}", 'value', $reqv[$reqv['form_type']]['mob_phone']);
            } else {
                sbr_meta::$reqv_fields[$reqv['form_type']]['mob_phone']['maxlength'] = 15;
                $error = sbr_meta::setUserReqv($sUid, $reqv['rez_type'], $reqv['form_type'], $nreqv);
            }
        }
        $res = users::ChangeSafetyPhone($sUid, $sPhone, $sPhoneOnly);
        $error = sbr_meta::safetyMobPhone($sUid, $sSafetyMob);
        if ($res) {
            $objResponse->alert($res);
            $objResponse->script("\$('safety_phone_show{$sUid}').setStyle('display', '');");
        } else {
            $sChecked = $sPhoneOnly == 't' ? 'true' : 'false';
            $sDisplay = $sPhoneOnly == 't' ? '' : 'none';
            $sSafetyMobDisplay = $sSafetyMob == 't' ? '' : 'none';
            $objResponse->assign("safety_phone_value{$sUid}", 'innerHTML', $sPhone);
            $objResponse->assign("safety_phone_hidden{$sUid}", 'value', $sPhone);
            $objResponse->script("\$('safety_only_phone_show{$sUid}').setStyle('display', '{$sDisplay}');");
            $objResponse->script("\$('is_safety_mob_show{$sUid}').setStyle('display', '{$sSafetyMobDisplay}');");
            $sDisplay = trim($sPhone) ? '' : 'none';
            $objResponse->script("\$('safety_phone_show{$sUid}').setStyle('display', '{$sDisplay}');");
        }
        $objResponse->script("\$('safety_phone_edit{$sUid}').setStyle('display', 'none');");
    }
    return $objResponse;
}
Esempio n. 4
0
function checkCode($phone, $code, $type = "bind")
{
    $objResponse = new xajaxResponse();
    $success = 0;
    $reqv = sbr_meta::getUserReqvs(get_uid(false));
    $ureqv = $reqv[$reqv['form_type']];
    $uid = get_uid(false);
    if ($type == 'unbind') {
        $phone = $ureqv['mob_phone'];
    }
    $error = false;
    if ($code == $_SESSION['send_sms_code'] && $phone == $_SESSION['send_sms_phone']) {
        unset($_SESSION['send_sms_code'], $_SESSION['send_sms_phone']);
        $user = new users();
        $ureqv['mob_phone'] = $phone;
        $save_reqv['mob_phone'] = $phone;
        if ($type == 'bind') {
            if (!($text_error = sbr_meta::setUserReqv($uid, $reqv['rez_type'], $reqv['form_type'], $save_reqv))) {
                sbr_meta::authMobPhone($uid, true);
                $reqv['is_activate_mob'] = 't';
                unset($_SESSION["unbind_phone_action"]);
                unset($_SESSION['send_sms_time']);
                $success = 2;
            } else {
                $error = current($text_error);
                // Телефон забит
            }
        } else {
            if ($type == 'unbind') {
                // Сбрасываем все
                $phone = '';
                $save_reqv['mob_phone'] = '';
                $ureqv['mob_phone'] = '';
                sbr_meta::setUserReqv($uid, $reqv['rez_type'], $reqv['form_type'], $save_reqv);
                // Удаляем телефон
                sbr_meta::authMobPhone($uid, false);
                sbr_meta::safetyMobPhone($uid, false);
                $user->updateSafetyPhone($uid, false);
                $reqv['is_activate_mob'] = 'f';
                $_SESSION["unbind_phone_action"] = true;
                $success = 3;
            }
        }
    } else {
        $error = 'Неправильный код';
    }
    switch ($success) {
        case 2:
            //Прицепили телефон
            $objResponse->script("\$('safety_status')" . ".set('text', 'включена')" . ".removeClass('b-layout__txt_color_c10600')" . ".addClass('b-layout__txt_color_6db335');");
            $objResponse->script("\$('mob_phone_text').set('html', " . "'<a href=\"javascript:void(0)\" onclick=\"User_Phone.unbindStart();\" " . "class=\"b-layout__link b-layout__link_fontsize_11 b-layout__link_bordbot_dot_0f71c8\">Отвязать</a>')");
            $objResponse->script("\$('mob_phone_text').removeClass('b-layout__txt_hide')");
            $objResponse->script("\$('mob_code_block').addClass('b-layout__txt_hide');");
            $objResponse->script("\$('buttons_step1').addClass('b-layout__txt_hide');");
            $objResponse->script("\$('buttons_step2').removeClass('b-layout__txt_hide');");
            break;
        case 3:
            //Отцепили телефон
            $objResponse->script("\$('safety_status')" . ".set('text', 'выключена')" . ".removeClass('b-layout__txt_color_6db335')" . ".addClass('b-layout__txt_color_c10600');");
            $objResponse->script("\$('mob_phone_text').set('text', 'без пробелов и дефиса')");
            $objResponse->script("\$('sms_sent_ok').addClass('b-layout__txt_hide');");
            $objResponse->script("\$('smscode').set('value', '');");
            $objResponse->script("\$('buttons_step1').removeClass('b-layout__txt_hide');");
            $objResponse->script("\$('buttons_step3').addClass('b-layout__txt_hide');");
            break;
        case 0:
        default:
            $objResponse->script("\$('smscode').getParent().addClass('b-combo__input_error');");
    }
    if ($error) {
        $objResponse->script("\$('sms_error').set('html', '{$error}').removeClass('b-layout__txt_hide');");
    } else {
        $objResponse->script("\$('sms_error').addClass('b-layout__txt_hide');");
    }
    $objResponse->script("shadow_center();");
    return $objResponse;
}