Ejemplo n.º 1
0
function registerUser($mobileNum, $md5Password)
{
    $ec_salt = rand(1000, 9999);
    $password = md5($md5Password . $ec_salt);
    $rankId = getNewUserRankId();
    $sql = "INSERT INTO " . $GLOBALS['ecs']->table('users') . "(user_name, ec_salt, mobile_phone, chat_validated, password, user_rank) VALUES('{$mobileNum}', '{$ec_salt}', '{$mobileNum}', 2, '{$password}', {$rankId})";
    if ($GLOBALS['db']->query($sql)) {
        require_once WEB_ROOT . '/includes/lib_integral.php';
        $userId = $GLOBALS['db']->insert_id();
        user_get_point($GLOBALS['_CFG']['validated_integral'], $userId, 4, '手机验证获得积分', 0);
        user_has_got_integral('phone', $userId);
        return true;
    }
    return false;
}
Ejemplo n.º 2
0
                    $sql = "UPDATE " . $ecs->table('users') . " SET chat_validated = {$chat_validated} WHERE user_id='{$id}'";
                    $db->query($sql);
                    $sql = 'SELECT user_name, email FROM ' . $ecs->table('users') . " WHERE user_id = '{$id}'";
                    $row = $db->getRow($sql);
                    show_message(sprintf('您已成功解除邮箱绑定', $row['user_name'], $row['email']), $_LANG['profile_lnk'], 'user.php');
                    break;
                case "emailUserValid":
                    $sql = "update " . $GLOBALS['ecs']->table('users') . " set email=user_name,chat_validated = 1 where user_id='{$id}'";
                    $db->query($sql);
                    $_SESSION['user_id'] = $id;
                    $row = $db->getRow('SELECT user_name, user_rank FROM ' . $ecs->table('users') . " WHERE user_id = '{$id}'");
                    $_SESSION['user_name'] = $row['user_name'];
                    $_SESSION['user_rank'] = 1;
                    require_once dirname(__FILE__) . '/includes/lib_integral.php';
                    user_get_point($_CFG['validated_integral'], $id, 4, '邮箱验证获得积分', 0);
                    user_has_got_integral('email', $id);
                    show_message('邮箱注册成功!', $_LANG['profile_lnk'], 'user.php');
                    break;
            }
        }
    }
    show_message($_LANG['validate_fail']);
} elseif ($action == 'is_registered') {
    include_once ROOT_PATH . 'includes/lib_passport.php';
    $username = trim($_GET['username']);
    $username = json_str_iconv($username);
    $type = isset($_GET['type']) ? $_GET['type'] : '';
    if ($type != 'email' && $type != 'phone') {
        die(json_encode('register type isn\'t email or phone'));
    }
    if ($user->check_user($username) || admin_registered($username)) {