예제 #1
0
파일: user.php 프로젝트: GYWang1983/fruit
             $extend_field_str .= " ('" . $_SESSION['user_id'] . "', '" . $val['id'] . "', '" . compile_str($temp_field_content) . "'),";
         }
     }
     $extend_field_str = substr($extend_field_str, 0, -1);
     if ($extend_field_str) {
         $sql = 'INSERT INTO ' . $ecs->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str;
         $db->query($sql);
     }
     /* 写入密码提示问题和答案 */
     if (!empty($passwd_answer) && !empty($sel_question)) {
         $sql = 'UPDATE ' . $ecs->table('users') . " SET `passwd_question`='{$sel_question}', `passwd_answer`='{$passwd_answer}'  WHERE `user_id`='" . $_SESSION['user_id'] . "'";
         $db->query($sql);
     }
     /* 判断是否需要绑定手机号 */
     if ($_CFG['ecsdxt_mobile_reg'] == '1') {
         if (!bind_mobile($username, $mobile, $smscode)) {
             /* 绑定手机失败 */
             show_message($_LANG['bind_mobile_failed']);
         }
     }
     /* 判断是否需要自动发送注册邮件 */
     if ($GLOBALS['_CFG']['member_email_validate'] && $GLOBALS['_CFG']['send_verify_email']) {
         send_regiter_hash($_SESSION['user_id']);
     }
     $ucdata = empty($user->ucdata) ? "" : $user->ucdata;
     if (!empty($_POST['next'])) {
         ecs_header("Location: flow.php?step={$_POST[next]}\n");
     } else {
         show_message(sprintf($_LANG['register_success'], $username . $ucdata), array($_LANG['back_up_page'], $_LANG['profile_lnk']), array($back_act, 'user.php'), 'info');
     }
 } else {
예제 #2
0
파일: user.php 프로젝트: GYWang1983/fruit
     exit;
 }
 $mobile_phone = $_POST['mobile_phone'];
 $smscode = $_POST['smscode'];
 $success = false;
 $sql = "SELECT COUNT(user_id) FROM " . $ecs->table('users') . " a, wxch_user b WHERE " . " a.user_id = b.uid AND a.mobile_phone = '{$mobile_phone}'";
 if ($db->getOne($sql) > 0) {
     $message = "{$mobile_phone}已和其他用户绑定";
     $mobile_phone = '';
 } else {
     include_once ROOT_PATH . 'include/lib_sms.php';
     include_once ROOT_PATH . 'include/lib_passport.php';
     if (check_sms_verifycode($mobile_phone, $smscode, SMS_WXBIND)) {
         $other_user = $GLOBALS['user']->get_profile_by_mobile($mobile_phone);
         if (empty($other_user)) {
             $success = bind_mobile($_SESSION['user_name'], $mobile_phone, $smscode, SMS_WXBIND);
         } else {
             $uid = $_SESSION[user_id];
             // 已在PC端注册,首次绑定微信
             $SQL = "UPDATE wxch_user SET uid = {$other_user[user_id]} WHERE uid = {$uid}";
             $db->query($SQL);
             $SQL = "DELETE FROM " . $ecs->table('users') . " WHERE user_id = {$uid}";
             $db->query($SQL);
             $GLOBALS['user']->set_session($other_user);
             $GLOBALS['user']->set_cookie($other_user, true);
             update_user_info();
             update_user_cart($uid);
             recalculate_price();
             $success = true;
         }
     } else {