loaducenter();
//创建账号并登陆
$username = trim(dhtmlspecialchars($insert_arr['conqqnick']));
if($username==''){$username = 'qquser_'.time();}
$password = md5(random(10));
$email = 'hl'.time() . '@qq.com';
$uid = uc_user_register($username, $password, $email);
if ($uid <= 0) {
if ($uid == -1 || $uid == -3) {
$username .= time();
$uid = uc_user_register($username, $password, $email);
if ($uid <= 0) {
$username = 'qquser_'.time();
$uid = uc_user_register($username, $password, $email);
if($uid <=0){
showmessage("$username注册UC失败",$referer);exit();
}
}
} elseif ($uid == -2) {
showmessage('包含不允许注册的词语',$referer);
} elseif ($uid == -4) {
showmessage('Email 格式有误',$referer);
} elseif ($uid == -5) {
showmessage('Email 不允许注册',$referer);
} else {
showmessage('其他错误',$referer);
}
}
//插入common_member
$init_arr = array('credits' => explode(',', $_G['setting']['initcredits']));
$groupid = 10 ;//默认新手上路组
C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupid, $init_arr);
//会员绑定openid
C::t('#qqconnect#common_member_connect')->insert(
!$_G['setting']['connect']['oauth2'] ? array(
'uid' => $uid,
'conuin' => $conuin,
'conuinsecret' => $conuinsecret,
'conopenid' => $conopenid,
'conispublishfeed' => $conispublishfeed,
'conispublisht' => $conispublisht,
'conisregister' => 0,
'conisfeed' => 1,
'conisqqshow' => $isqqshow,
) : array(
'uid' => $uid,
'conuin' => '',
'conuintoken' => $conuintoken,
'conopenid' => $conopenid,
'conispublishfeed' => $conispublishfeed,
'conispublisht' => $conispublisht,
'conisregister' => 0,
'conisfeed' => 1,
'conisqqshow' => $isqqshow,
)
);
//更新是否绑定
C::t('common_member')->update($uid, array('conisbind' => '1'));
//模拟登录
$connect_member = C::t('#qqconnect#common_member_connect')->fetch_fields_by_openid($conopenid, $fields);
connect_login($connect_member);
//最后一次登录状态
C::t('common_member_status')->update($uid, array('lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP));
C::t('#qqconnect#common_connect_guest')->delete($conopenid);
//更新新注册用户缓存
if(!function_exists('build_cache_userstats')) { require_once libfile('cache/userstats', 'function'); }
build_cache_userstats();
//省去用户绑定的话,这里可以直接创建一个账号并绑定
//$referer = 'member.php?mod=connect&referer='.urlencode($referer);
$utilService->redirect($referer);