function xwb_setSiteRegister($nickname, $email, $pwd = false) { $db = XWB_plugin::getDB(); $uid = 0; $password = $pwd ? $pwd : rand(100000, 999999); $regstatus = jsg_member_register_check_status(); if ($regstatus['normal_enable'] || true === JISHIGOU_FORCED_REGISTER) { $uid = jsg_member_register($nickname, $password, $email); } $rst = array('uid' => $uid, 'password' => $password); return $rst; }
function _reg_check() { $regstatus = jsg_member_register_check_status(); if ($regstatus['error']) { return $regstatus['error']; } if (true !== JISHIGOU_FORCED_REGISTER && $regstatus['invite_enable']) { if (!$regstatus['normal_enable']) { return '本站目前需要有邀请链接才能注册。' . jsg_member_third_party_reg_msg(); } } $in_ajax = get_param('in_ajax'); if ($in_ajax) { $this->Post = array_iconv('utf-8', $this->Config['charset'], $this->Post, 1); } $nickname = trim($this->Post['nickname']); $email = trim($this->Post['email']); $rets = array('0' => '[未知错误] 有可能是站点关闭了注册功能', '-1' => '不合法', '-2' => '不允许注册', '-3' => '已经存在了', '-4' => '不合法', '-5' => '不允许注册', '-6' => '已经存在了'); $ret = jsg_member_checkname($nickname, 1); if ($ret < 1) { return "帐户/昵称 " . $rets[$ret]; } $ret = jsg_member_checkemail($email); if ($ret < 1) { return "Email " . $rets[$ret]; } $password = trim($this->Post['password']); if (strlen($password) < 6) { return "密码至少5位以上"; } return ''; }
<body id="xwb-plugin-register-layer" class="xwb-plugin" style="display:block;"> <h3 id="forRegH3" class="xwb-plugin-layer-title">您正在用<a class="xwb-plugin-td-right-a" href="http://weibo.com/u/<?php echo $sina_user_info['id']; ?> " target="_blank">新浪微博帐号</a>登录本站,如您还无本站帐号请设置以下信息:</h3> <h3 id="forBindH3" class="xwb-plugin-layer-title" style="display:none;">输入已有的<?php echo XWB_S_TITLE; ?> 帐号信息,绑定当前<a class="xwb-plugin-td-right-a" href="http://weibo.com/u/<?php echo $sina_user_info['id']; ?> " target="_blank">新浪微博帐号</a>。</h3> <div id="regBox" class="xwb-plugin-form" style="display:block;"> <?php $regstatus = jsg_member_register_check_status(); if ($regstatus['error'] || true !== JISHIGOU_FORCED_REGISTER && $regstatus['invite_enable'] && !$regstatus['normal_enable']) { ?> 非常抱歉,本站目前禁止绑定新注册用户;<a href="javascript:void(function(){})" class="xwb-plugin-td-right-a" onclick="forTurn('bind')" tabindex="-1"><span><strong>请点此绑定已有的帐号</strong></span></a> <?php } else { ?> <form action="<?php echo XWB_plugin::URL("xwbSiteInterface.doReg"); ?> " id="siteRegFrom" method="post" target="xwbSiteRegister" > <input type="hidden" name="FORMHASH" value="<?php echo FORMHASH;
function DoRegister() { if (MEMBER_ID != 0 and false == $this->IsAdmin) { $this->Messager('您已经是注册用户,无需再注册!', -1); } $regstatus = jsg_member_register_check_status(); if ($regstatus['error']) { $this->Messager($regstatus['error'], null); } $message = array(); $timestamp = time(); $noemail = 0; $sms_ckret = 0; if ($this->_sms_register()) { $sms_bind_num = $this->Post['sms_bind_num']; $sms_bind_key = $this->Post['sms_bind_key']; $sms_ckret = sms_check_bind_key($sms_bind_num, $sms_bind_key); if ($sms_ckret) { $this->Messager($sms_ckret, -1); } $noemail = jconf::get('sms', 'register_verify', 'noemail'); if ($noemail) { $this->Post['email'] = $sms_bind_num . '@139.com'; } } if ($this->Config['seccode_enable'] == 1 && $this->Config['seccode_register']) { if (!ckseccode(@$_POST['seccode'])) { $this->Messager("验证码输入错误", -1); } } elseif ($this->Config['seccode_enable'] > 1 && $this->Config['seccode_register'] && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) { $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['add_YinXiangMa_challenge'], @$_POST['add_YXM_level'][0], @$_POST['add_YXM_input_result']); if ($YinXiangMa_response != "true") { $this->Messager("验证码输入错误", -1); } } $inviter_member = array(); $invite_code = $this->Post['invite_code'] ? $this->Post['invite_code'] : $this->Get['invite_code']; $check_result = jsg_member_register_check_invite($invite_code); if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) { if (!$invite_code) { $this->Messager("本站目前需要有好友邀请链接才能注册。<br><br>看看<a href=\"?mod=topic&code=top\">达人榜</a>中有没有你认识的人,让他给你发一个好友邀请。", null); } if (!$check_result) { $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null); } } if ($check_result['uid'] > 0) { $inviter_member = jsg_member_info($check_result['uid']); } if (!$inviter_member && $this->Config['register_invite_input']) { $inviter_member = jsg_member_info($this->Post['inviter_nickname'], 'nickname'); } $password = $this->Post['password']; $email = $this->Post['email']; $username = $nickname = $this->Post['nickname']; if (strlen($password) < 5) { $this->Messager("密码过短,请设置至少5位", -1); } if ($password != $this->Post['password2']) { $this->Messager("两次输入的密码不相同", -1); } if ($GLOBALS['_J']['plugins']['func']['reg']) { hookscript('reg', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'reg'); } $uid = jsg_member_register($nickname, $password, $email); if ($uid < 1) { $regconf = jconf::get('register'); $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。', '-7' => '您的IP地址 ' . $GLOBALS['_J']['client_ip'] . ' 已经被限制注册了(一个IP地址 ' . $regconf['time_html'] . ' 之内,最多只能注册 ' . $regconf['limit'] . ' 个用户),请稍后再试或联系管理员'); $this->Messager($rets[$uid], null); } $datas = array(); $datas['uid'] = $uid; if ($this->_sms_register()) { $datas['phone'] = $sms_bind_num; } jtable('members')->update($datas); if ($this->_sms_register()) { $_sms_info = _sms_client_user($sms_bind_num); $_sms_sets = array('uid' => $uid, 'username' => $username, 'bind_key' => 0, 'bind_key_time' => 0, 'try_bind_times' => '+1', 'last_try_bind_time' => $timestamp); sms_client_user_update($_sms_sets, $_sms_info); } if ($inviter_member) { jsg_member_register_by_invite($inviter_member['uid'], $uid, $check_result); } $rets = jsg_member_login($uid, $password, 'uid'); $redirect_to = jget('referer'); if (!$redirect_to || $redirect_to == $this->Config['site_url']) { if ($this->Config['reg_email_verify']) { $redirect_to = jurl('index.php?mod=member&code=setverify&ids=' . $uid . '&from=reg'); } elseif ($this->Config['reg_step3_radio']) { $redirect_to = jurl('index.php?mod=member&code=follow_channel'); } elseif ($this->Config['reg_step4_radio']) { $redirect_to = jurl('index.php?mod=member&code=follow_member'); } elseif ($this->Config['reg_step5_radio']) { $redirect_to = jurl('index.php?mod=member&code=add_face'); } elseif ($this->Config['reg_step6_radio']) { $redirect_to = jurl('index.php?mod=member&code=member_profile'); } elseif ($this->Config['reg_step7_radio']) { $redirect_to = jurl('index.php?mod=member&code=do_first_topic'); } else { $redirect_to = jurl('index.php?mod=topic'); } } $this->Messager(NULL, $redirect_to, 0); }
function jsg_member_register_is_closed() { $rets = jsg_member_register_check_status(); return $rets['error'] ? true : false; }
function register_check_invite($invite_code = '', $reset = 0) { $invite_code = $invite_code ? $invite_code : ($_POST['invite_code'] ? $_POST['invite_code'] : $_GET['invite_code']); $regstatus = jsg_member_register_check_status(); $result = $regstatus['invite_enable'] ? false : true; if ($invite_code) { $invite_max = (int) $GLOBALS['_J']['config']['invite_count_max']; if (is_numeric($invite_code)) { $u = $invite_code; } else { $invite_code = str_replace(array('@', '#', '-', '_'), '|', (string) $invite_code); list($u, $c) = explode('|', $invite_code); } if (($u = (int) $u) > 0) { $c_l = strlen($c = trim($c)); if (32 == $c_l) { $row = DB::fetch_first("select * from `" . TABLE_PREFIX . "invite` where `id`='{$u}'"); if ($row) { if (!$result) { $result = $c == md5($row['id'] . $row['code'] . $row['dateline'] . $row['femail']); } $invite_id = $u; $u = $row['uid']; $c = $row['code']; } else { $result = false; } } $row = jsg_member_info($u); if ($row) { if ($c && !$result && ('admin' == $row['role_type'] || $invite_max < 1 || $invite_max >= $row['invite_count'])) { $result = $row['invitecode'] == $c; } } else { $result = false; } if ($reset && $row['uid'] > 0) { $result = DB::query("update `" . TABLE_PREFIX . "members` set `invitecode`='" . substr(md5($row['uid'] . $row['invitecode'] . random(16) . time()), 0, 16) . "' where `uid`='{$row['uid']}'"); } } } $result = $result ? array('uid' => $u, 'code' => $c, 'invite_id' => $invite_id) : false; return $result; }
function DoRegister() { if (MEMBER_ID != 0 and false == $this->IsAdmin) { $this->Messager('您已经是注册用户,无需再注册!', -1); } $regstatus = jsg_member_register_check_status(); if ($regstatus['error']) { $this->Messager($regstatus['error'], null); } $message = array(); $timestamp = time(); $noemail = 0; $sms_ckret = 0; if ($this->_sms_register()) { $sms_bind_num = $this->Post['sms_bind_num']; $sms_bind_key = $this->Post['sms_bind_key']; $sms_ckret = sms_check_bind_key($sms_bind_num, $sms_bind_key); if ($sms_ckret) { $this->Messager($sms_ckret, -1); } $noemail = jconf::get('sms', 'register_verify', 'noemail'); if ($noemail) { $this->Post['email'] = $sms_bind_num . '@139.com'; } } $inviter_member = array(); $invite_code = $this->Post['invite_code'] ? $this->Post['invite_code'] : $this->Get['invite_code']; $check_result = jsg_member_register_check_invite($invite_code); if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) { if (!$invite_code) { $this->Messager("本站目前需要有好友邀请链接才能注册。<br><br>看看<a href=\"?mod=topic&code=top\">达人榜</a>中有没有你认识的人,让他给你发一个好友邀请。", null); } if (!$check_result) { $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null); } } if ($check_result['uid'] > 0) { $inviter_member = jsg_member_info($check_result['uid']); } if (!$inviter_member && $this->Config['register_invite_input']) { $inviter_member = jsg_member_info($this->Post['inviter_nickname'], 'nickname'); } $this->Post = array_iconv('UTF-8', $this->Config['charset'], $this->Post, 1); $password = $this->Post['password']; $email = $this->Post['email']; $username = $nickname = $this->Post['nickname']; if (strlen($password) < 5) { $this->Messager("密码过短,请设置至少5位", -1); } $uid = jsg_member_register($nickname, $password, $email); if ($uid < 1) { $regconf = jconf::get('register'); $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。', '-7' => '您的IP地址 ' . $GLOBALS['_J']['client_ip'] . ' 已经被限制注册了(一个IP地址 ' . $regconf['time_html'] . ' 之内,最多只能注册 ' . $regconf['limit'] . ' 个用户),请稍后再试或联系管理员'); $this->Messager($rets[$uid], null); } $datas = array(); $datas['uid'] = $uid; $datas['province'] = $this->Post['province']; $datas['city'] = $this->Post['city']; if ($this->_sms_register()) { $datas['phone'] = $sms_bind_num; } jtable('members')->update($datas); if ($this->_sms_register()) { $_sms_info = _sms_client_user($sms_bind_num); $username = $username ? $username : $this->Post['username']; $_sms_sets = array('uid' => $uid, 'username' => $username, 'bind_key' => 0, 'bind_key_time' => 0, 'try_bind_times' => '+1', 'last_try_bind_time' => $timestamp); sms_client_user_update($_sms_sets, $_sms_info); } if ($inviter_member) { $u = $inviter_member['uid']; $c = $check_result['code']; buddy_add($u, $uid); buddy_add($uid, $u); if (0 < ($invite_id = $check_result['invite_id'])) { $row = DB::fetch_first("select * from `" . TABLE_PREFIX . "invite` where `id`='{$invite_id}'"); if ($row) { DB::query("update `" . TABLE_PREFIX . "invite` set `fuid`='{$uid}',`fusername`='{$username}' where `id`='{$row['id']}'"); } } else { DB::query("insert into `" . TABLE_PREFIX . "invite` (`uid`,`code`,`dateline`,`fuid`,`fusername`,`femail`) values ('{$u}','{$c}','{$timestamp}','{$uid}','{$username}','{$email}')"); } $sql = "update `" . TABLE_PREFIX . "members` set `invite_count`=`invite_count`+1 where `uid`='{$u}'"; $this->DatabaseHandler->Query($sql); $sql = "update `" . TABLE_PREFIX . "members` set `invite_uid`='{$inviter_member['uid']}' where `uid`='{$uid}'"; $this->DatabaseHandler->Query($sql); if ($c && $this->Config['invite_limit'] > 0) { $code_invite_count = DB::result_first("select count(*) as code_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$u}' and `code`='{$c}'"); if ($code_invite_count > $this->Config['invite_limit']) { jsg_member_register_check_invite($u, 1); } } if ($this->Config['extcredits_enable'] && $u > 0) { update_credits_by_action('register', $u); } } $rets = jsg_member_login_set_status($uid); $this->Messager(null, 'index.php'); }