/** * 判断是否是合格的手机客户端 * * @return boolean */ function is_mobile($ignore_cookie = false) { if (HTTP::get_cookie('_ignore_ua_check') == 'TRUE' and !$ignore_cookie) { return false; } $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); if (preg_match('/playstation/i', $user_agent) or preg_match('/ipad/i', $user_agent) or preg_match('/ucweb/i', $user_agent)) { return false; } if (preg_match('/iemobile/i', $user_agent) or preg_match('/mobile\\ssafari/i', $user_agent) or preg_match('/iphone\\sos/i', $user_agent) or preg_match('/android/i', $user_agent) or preg_match('/symbian/i', $user_agent) or preg_match('/series40/i', $user_agent)) { return true; } return false; }
public function register_process_action() { $fack = $this->model('account')->fack_insert($_POST['user_name'], $_POST['password'], $_POST['email']); if (get_setting('register_type') == 'close') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站目前关闭注册'))); } else { if (get_setting('register_type') == 'invite' and !$_POST['icode']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过邀请注册'))); } else { if (get_setting('register_type') == 'weixin') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过微信注册'))); } } } if ($_POST['icode']) { if (!($invitation = $this->model('invitation')->check_code_available($_POST['icode'])) and $_POST['email'] == $invitation['invitation_email']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('邀请码无效或与邀请邮箱不一致'))); } } if ($_POST['user_name'] == '') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入用户名'))); } else { if ($this->model('account')->check_username($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名已经存在'))); } } /* else if (!$this->model('account')->check_yqm($_POST['yqm'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('邀请码无效或与邀请邮箱不一致'))); } else if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名包含无效字符'))); } else if ($this->model('account')->check_username_sensitive_words($_POST['user_name']) OR trim($_POST['user_name']) != $_POST['user_name']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名中包含敏感词或系统保留字'))); } if ($this->model('account')->check_email($_POST['email'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确'))); } if (strlen($_POST['password']) < 6 OR strlen($_POST['password']) > 16) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('密码长度不符合规则'))); } */ if (!$_POST['agreement_chk']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用户协议才能继续'))); } // 检查验证码 if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify']) and get_setting('register_seccode') == 'Y') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请填写正确的验证码'))); } if (get_setting('ucenter_enabled') == 'Y') { $result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']); if (is_array($result)) { $uid = $result['user_info']['uid']; } else { H::ajax_json_output(AWS_APP::RSM(null, -1, $result)); } } else { $uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']); } if ($_POST['email'] == $invitation['invitation_email']) { $this->model('active')->set_user_email_valid_by_uid($uid); $this->model('active')->active_user_by_uid($uid); } if (isset($_POST['sex'])) { $update_data['sex'] = intval($_POST['sex']); if ($_POST['province']) { $update_data['province'] = $_POST['province']; $update_data['city'] = $_POST['city']; } if ($_POST['job_id']) { $update_data['job_id'] = intval($_POST['job_id']); } $update_attrib_data['signature'] = $_POST['signature']; // 更新主表 $this->model('account')->update_users_fields($update_data, $uid); // 更新从表 $this->model('account')->update_users_attrib_fields($update_attrib_data, $uid); } $this->model('account')->setcookie_logout(); $this->model('account')->setsession_logout(); if ($_POST['icode']) { $follow_users = $this->model('invitation')->get_invitation_by_code($_POST['icode']); } else { if (HTTP::get_cookie('fromuid')) { $follow_users = $this->model('account')->get_user_info_by_uid(HTTP::get_cookie('fromuid')); } } if ($follow_users['uid']) { $this->model('follow')->user_follow_add($uid, $follow_users['uid']); $this->model('follow')->user_follow_add($follow_users['uid'], $uid); $this->model('integral')->process($follow_users['uid'], 'INVITE', get_setting('integral_system_config_invite'), '邀请注册: ' . $_POST['user_name'], $follow_users['uid']); } if ($_POST['icode']) { $this->model('invitation')->invitation_code_active($_POST['icode'], time(), fetch_ip(), $uid); } if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') { $this->model('active')->active_user_by_uid($uid); } $user_info = $this->model('account')->get_user_info_by_uid($uid); if (get_setting('register_valid_type') == 'N' or $user_info['group_id'] != 3 or $_POST['email'] == $invitation['invitation_email']) { $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt'], null, true, $user_info['group_id']); if (!$_POST['_is_mobile']) { H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/home/first_login-TRUE')), 1, null)); } } else { AWS_APP::session()->valid_email = $user_info['email']; $this->model('active')->new_valid_email($uid); if (!$_POST['_is_mobile']) { H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/account/valid_email/')), 1, null)); } } if ($_POST['_is_mobile']) { if ($_POST['return_url']) { $user_info = $this->model('account')->get_user_info_by_uid($uid); $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt'], null, true, $user_info['group_id']); $return_url = strip_tags($_POST['return_url']); } else { $return_url = get_js_url('/m/'); } H::ajax_json_output(AWS_APP::RSM(array('url' => $return_url), 1, null)); } }
public function register_process_action() { if (get_setting('register_type') == 'close') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站目前关闭注册'))); } else { if (get_setting('register_type') == 'invite' and !$_POST['icode']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过邀请注册'))); } else { if (get_setting('register_type') == 'weixin') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过微信注册'))); } } } if ($_POST['icode']) { if (!($invitation = $this->model('invitation')->check_code_available($_POST['icode'])) and $_POST['email'] == $invitation['invitation_email']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('邀请码无效或与邀请邮箱不一致'))); } } if (trim($_POST['user_name']) == '') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入用户名'))); } else { if ($this->model('account')->check_username($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名已经存在'))); } else { if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名包含无效字符'))); } else { if ($this->model('account')->check_username_sensitive_words($_POST['user_name']) or trim($_POST['user_name']) != $_POST['user_name']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名中包含敏感词或系统保留字'))); } } } } if ($this->model('account')->check_email($_POST['email'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确'))); } if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('密码长度不符合规则'))); } // if (! $_POST['agreement_chk']) // { // H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用户协议才能继续'))); // } // 检查验证码 // if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify']) AND get_setting('register_seccode') == 'Y') // { // H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请填写正确的验证码'))); // } if (get_setting('ucenter_enabled') == 'Y') { $result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']); if (is_array($result)) { $uid = $result['user_info']['uid']; } else { H::ajax_json_output(AWS_APP::RSM(null, -1, $result)); } } else { $uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']); } if ($_POST['email'] == $invitation['invitation_email']) { $this->model('active')->set_user_email_valid_by_uid($uid); $this->model('active')->active_user_by_uid($uid); } $this->model('account')->setcookie_logout(); $this->model('account')->setsession_logout(); if ($_POST['icode']) { $follow_users = $this->model('invitation')->get_invitation_by_code($_POST['icode']); } else { if (HTTP::get_cookie('fromuid')) { $follow_users = $this->model('account')->get_user_info_by_uid(HTTP::get_cookie('fromuid')); } } if ($follow_users['uid']) { $this->model('follow')->user_follow_add($uid, $follow_users['uid']); $this->model('follow')->user_follow_add($follow_users['uid'], $uid); $this->model('integral')->process($follow_users['uid'], 'INVITE', get_setting('integral_system_config_invite'), '邀请注册: ' . $_POST['user_name'], $follow_users['uid']); } if ($_POST['icode']) { $this->model('invitation')->invitation_code_active($_POST['icode'], time(), fetch_ip(), $uid); } if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') { $this->model('active')->active_user_by_uid($uid); } $user_info = $this->model('account')->get_user_info_by_uid($uid); if (get_setting('register_valid_type') == 'N' or $user_info['group_id'] != 3 or $_POST['email'] == $invitation['invitation_email']) { $valid_email = 1; } else { AWS_APP::session()->valid_email = $user_info['email']; $this->model('active')->new_valid_email($uid); $valid_email = 0; } $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']); H::ajax_json_output(AWS_APP::RSM(array('uid' => $user_info['uid'], 'user_name' => $user_info['user_name'], 'valid_email' => $valid_email), 1, null)); }
public function register_process_action() { if (get_setting('register_type') == 'close') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��վĿǰ�ر�ע��'))); } else { if (get_setting('register_type') == 'invite' and !$_POST['icode']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��վֻ��ͨ������ע��'))); } else { if (get_setting('register_type') == 'weixin') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��վֻ��ͨ����ע��'))); } } } if ($_POST['icode']) { if (!($invitation = $this->model('invitation')->check_code_available($_POST['icode'])) and $_POST['email'] == $invitation['invitation_email']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��������Ч�����������䲻һ��'))); } } if (trim($_POST['user_name']) == '') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�������û���'))); } else { if ($this->model('account')->check_username($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�û����Ѿ�����'))); } else { if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�û������Ч�ַ�'))); } else { if ($this->model('account')->check_username_sensitive_words($_POST['user_name']) or trim($_POST['user_name']) != $_POST['user_name']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�û����а���дʻ�ϵͳ������'))); } } } } if ($this->model('account')->check_email($_POST['email'])) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail �Ѿ���ʹ��, ���ʽ����ȷ'))); } if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('���볤�Ȳ���Ϲ���'))); } if (!$_POST['agreement_chk']) { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�����ͬ���û�Э����ܼ���'))); } // �����֤�� if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify']) and get_setting('register_seccode') == 'Y') { H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('����д��ȷ����֤��'))); } if (get_setting('ucenter_enabled') == 'Y') { $result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']); if (is_array($result)) { $uid = $result['user_info']['uid']; } else { H::ajax_json_output(AWS_APP::RSM(null, -1, $result)); } } else { $uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']); } if ($_POST['email'] == $invitation['invitation_email']) { $this->model('active')->set_user_email_valid_by_uid($uid); $this->model('active')->active_user_by_uid($uid); } if (isset($_POST['sex'])) { $update_data['sex'] = intval($_POST['sex']); if ($_POST['province']) { $update_data['province'] = htmlspecialchars($_POST['province']); $update_data['city'] = htmlspecialchars($_POST['city']); } if ($_POST['job_id']) { $update_data['job_id'] = intval($_POST['job_id']); } $update_attrib_data['signature'] = htmlspecialchars($_POST['signature']); // ������� $this->model('account')->update_users_fields($update_data, $uid); // ���´ӱ� $this->model('account')->update_users_attrib_fields($update_attrib_data, $uid); } $this->model('account')->setcookie_logout(); $this->model('account')->setsession_logout(); if ($_POST['icode']) { $follow_users = $this->model('invitation')->get_invitation_by_code($_POST['icode']); } else { if (HTTP::get_cookie('fromuid')) { $follow_users = $this->model('account')->get_user_info_by_uid(HTTP::get_cookie('fromuid')); } } if ($follow_users['uid']) { $this->model('follow')->user_follow_add($uid, $follow_users['uid']); $this->model('follow')->user_follow_add($follow_users['uid'], $uid); $this->model('integral')->process($follow_users['uid'], 'INVITE', get_setting('integral_system_config_invite'), '����ע��: ' . $_POST['user_name'], $follow_users['uid']); } if ($_POST['icode']) { $this->model('invitation')->invitation_code_active($_POST['icode'], time(), fetch_ip(), $uid); } if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') { $this->model('active')->active_user_by_uid($uid); } $user_info = $this->model('account')->get_user_info_by_uid($uid); if (get_setting('register_valid_type') == 'N' or $user_info['group_id'] != 3 or $_POST['email'] == $invitation['invitation_email']) { $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']); if (!$_POST['_is_mobile']) { H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/home/first_login-TRUE')), 1, null)); } } else { AWS_APP::session()->valid_email = $user_info['email']; $this->model('active')->new_valid_email($uid); if (!$_POST['_is_mobile']) { H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/account/valid_email/')), 1, null)); } } if ($_POST['_is_mobile']) { if ($_POST['return_url']) { $user_info = $this->model('account')->get_user_info_by_uid($uid); $this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']); $return_url = strip_tags($_POST['return_url']); } else { $return_url = get_js_url('/m/'); } H::ajax_json_output(AWS_APP::RSM(array('url' => $return_url), 1, null)); } }