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 DoModifyProfile() { $op = jget('op'); $member_info = DB::fetch_first("SELECT * FROM " . DB::table('members') . " where `uid`='" . MEMBER_ID . "'"); if (!$member_info) { $this->Messager('用户已经不存在了', null); } $sql = "select * from `" . TABLE_PREFIX . "memberfields` where `uid`='" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); $memberfields = $query->GetRow(); if ($op) { #主表信息(members) $arr = array(); #性别 $this->Post['gender'] && ($arr['gender'] = (int) $this->Post['gender']); isset($this->Post['qq']) && ($arr['qq'] = ($qq = is_numeric($this->Post['qq']) ? $this->Post['qq'] : 0) > 10000 && strlen((string) $qq) < 11 ? $qq : ''); isset($this->Post['msn']) && ($arr['msn'] = trim(strip_tags($this->Post['msn']))); isset($this->Post['bday']) && ($arr['bday'] = $this->Post['bday']); isset($this->Post['phone']) && ($arr['phone'] = trim($this->Post['phone'])); isset($this->Post['aboutme']) && ($arr['aboutme'] = trim(strip_tags($this->Post['aboutme']))); if ($arr) { $this->_update($arr); } #附表信息(memberfield的字段profile_set) $member_profile_set = array(); if ($memberfields['profile_set']) { $member_profile_set = unserialize($memberfields['profile_set']); } $privacy = ($privacy = jget('privacy')) ? $privacy : array(); $member_profile_set = array_merge($member_profile_set, $privacy); $this->_updateMemberField(array('profile_set' => serialize($member_profile_set))); #附表2信息(members_profile) $arr2 = array(); $profileField = array('constellation', 'zodiac', 'telephone', 'address', 'zipcode', 'nationality', 'education', 'birthcity', 'graduateschool', 'pcompany', 'occupation', 'position', 'revenue', 'affectivestatus', 'lookingfor', 'bloodtype', 'height', 'weight', 'alipay', 'icq', 'yahoo', 'taobao', 'site', 'interest', 'linkaddress', 'field1', 'field2', 'field3', 'field4', 'field5', 'field6', 'field7', 'field8'); foreach ($profileField as $k => $v) { if ($v == 'birthcity') { $this->Post['b_province'] && ($birthcity['b_province'] = $this->Post['b_province']); $this->Post['b_city'] && ($birthcity['b_city'] = $this->Post['b_city']); $this->Post['b_area'] && ($birthcity['b_area'] = $this->Post['b_area']); $this->Post['b_street'] && ($birthcity['b_street'] = $this->Post['b_street']); if ($birthcity) { $arr2[$v] = implode('-', $birthcity); } } else { isset($this->Post[$v]) && ($arr2[$v] = trim(strip_tags($this->Post[$v]))); } } if ($arr2) { $this->_updateMemberProfile($arr2); } } else { foreach ($this->Post as $key => $val) { $key = strip_tags($key); $val = strip_tags($val); $this->Post[$key] = $val; } if ($member_info['invite_uid'] < 1 && $this->Post['invite_nickname'] && $this->Config['register_invite_input2']) { $_invite_member = jsg_member_info($this->Post['invite_nickname'], 'nickname'); if ($_invite_member) { jsg_member_register_by_invite($_invite_member['uid'], $member_info['uid']); } } $province = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['province'] . "'")); $city = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['city'] . "'")); if ($this->Post['area']) { $area = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['area'] . "'")); } if ($this->Post['street']) { $street = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['street'] . "'")); } $gender = in_array($gender = (int) $this->Post['gender'], array(1, 2)) ? $gender : 0; $email2 = preg_match("~^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\\.)+([a-z]{2,4})|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))\$~i", $email2 = trim($this->Post['email2'])) ? $email2 : ''; $qq = ($qq = is_numeric($this->Post['qq']) ? $this->Post['qq'] : 0) > 10000 && strlen((string) $qq) < 11 ? $qq : ''; $msn = trim(strip_tags($this->Post['msn'])); $aboutme = trim(strip_tags($this->Post['aboutme'])); $f_rets = filter($aboutme); if ($f_rets && $f_rets['error']) { $this->Messager($f_rets['msg'], null); } $signature = trim(strip_tags($this->Post['signature'])); $f_rets = filter($signature); if ($f_rets && $f_rets['error']) { $this->Messager($f_rets['msg'], null); } if (!$gender) { $this->Messager("性别不能为空,请返回修改", -1); } #修改主表(members) $arr = array('province' => addslashes($province), 'city' => addslashes($city), 'area' => addslashes($area), 'street' => addslashes($street), 'gender' => $gender, 'aboutme' => addslashes($aboutme), 'aboutmetime' => 0); if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) { if ($this->Post['companyid'] && $member_info['companyid'] == 0) { $arr['companyid'] = (int) $this->Post['companyid']; $arr['company'] = $this->CpLogic->Getone($arr['companyid'], 'company', 'name'); if ($arr['companyid'] > 0) { $this->CpLogic->update('company', $arr['companyid'], 1, $member_info['topic_count']); } } if ($this->Config['department_enable'] && $this->Post['departmentid'] && $member_info['departmentid'] == 0) { $arr['departmentid'] = (int) $this->Post['departmentid']; $arr['department'] = $this->CpLogic->Getone($arr['departmentid'], 'department', 'name'); if ($arr['departmentid'] > 0) { $this->CpLogic->update('department', $arr['departmentid'], 1, $member_info['topic_count']); } } if ($this->Post['jobid'] && $member_info['jobid'] == 0) { $arr['jobid'] = (int) $this->Post['jobid']; $arr['job'] = jlogic('job')->id2subject($arr['jobid']); } } $this->_update($arr); #修改附表(memberfiled) $arr1 = array(); if (!$memberfields['validate_true_name'] && $this->Post['validate_true_name']) { $arr1['validate_true_name'] = $this->Post['validate_true_name']; } if (!$memberfields['validate_card_type'] && $this->Post['validate_card_type']) { $arr1['validate_card_type'] = $this->Post['validate_card_type']; } if (!$memberfields['validate_card_id'] && $this->Post['validate_card_id']) { $arr1['validate_card_id'] = $this->Post['validate_card_id']; } if ($arr1) { $sets = array(); if (is_array($arr1)) { foreach ($arr1 as $key => $val) { $val = jfilter($val, 'txt'); $val = addslashes($val); $sets[$key] = "`{$key}`='{$val}'"; } } $sql = "update `" . TABLE_PREFIX . "memberfields` set " . implode(" , ", $sets) . " where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); } } $this->Messager("修改成功", '', 1); }