本文整理汇总了PHP中is_username函数的典型用法代码示例。如果您正苦于以下问题:PHP is_username函数的具体用法?PHP is_username怎么用?PHP is_username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _validate_form
private function _validate_form()
{
// 先验证用户名和密码
$this->load->library('form_validation');
$this->form_validation->set_message('required', '请输入{field}');
$this->form_validation->set_rules('username', '用户名', array('required', array('is_username', function ($str) {
if (is_username($str) || is_email($str) || is_phone($str)) {
return true;
}
$this->form_validation->set_message('is_username', '无效{field}');
return false;
})));
$this->form_validation->set_rules('password', '密码', array('required', array('is_password', function ($str) {
if (!is_password($str)) {
$this->form_validation->set_message('is_password', '无效{field}');
return false;
}
return true;
})));
if (!$this->form_validation->run()) {
return FALSE;
}
$this->form_validation->reset_validation();
$this->form_validation->set_message('required', '请输入{field}');
$this->form_validation->set_rules('captcha', '验证码', 'trim|required|callback_check_captcha');
return $this->form_validation->run();
}
示例2: __construct
/**
* 构造函数
*/
public function __construct()
{
$this->db = pc_base::load_model('member_model');
pc_base::load_app_func('global');
/*获取系统配置*/
$this->settings = getcache('settings', 'admin');
$this->applist = getcache('applist', 'admin');
if (isset($_GET) && is_array($_GET) && count($_GET) > 0) {
foreach ($_GET as $k => $v) {
if (!in_array($k, array('m', 'c', 'a'))) {
$_POST[$k] = $v;
}
}
}
if (isset($_POST['appid'])) {
$this->appid = intval($_POST['appid']);
} else {
exit('0');
}
if (isset($_POST['data'])) {
parse_str(sys_auth($_POST['data'], 'DECODE', $this->applist[$this->appid]['authkey']), $this->data);
if (empty($this->data) || !is_array($this->data)) {
exit('0');
}
if (!get_magic_quotes_gpc()) {
$this->data = new_addslashes($this->data);
}
if (isset($this->data['username']) && $this->data['username'] != '' && is_username($this->data['username']) == false) {
exit('-5');
}
if (isset($this->data['email']) && $this->data['username'] != '' && is_email($this->data['email']) == false) {
exit('-5');
}
if (isset($this->data['password']) && $this->data['password'] != '' && (is_password($this->data['password']) == false || is_badword($this->data['password']))) {
exit('-5');
}
if (isset($this->data['newpassword']) && $this->data['newpassword'] != '' && (is_password($this->data['newpassword']) == false || is_badword($this->data['newpassword']))) {
exit('-5');
}
} else {
exit('0');
}
if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
$this->data['avatardata'] = $GLOBALS['HTTP_RAW_POST_DATA'];
//if($this->applist[$this->appid]['authkey'] != $this->data['ps_auth_key']) {
// exit('0');
//}
}
}
示例3: checkuserinfo
/**
* 检查管理员名称
* @param array $data 管理员数据
*/
function checkuserinfo($data)
{
if (!is_array($data)) {
showmessage(L('parameters_error'));
return false;
} elseif (!is_username($data['username'])) {
showmessage(L('username_illegal'));
return false;
} elseif (empty($data['email']) || !is_email($data['email'])) {
showmessage(L('email_illegal'));
return false;
} elseif (empty($data['roleid'])) {
return false;
}
return $data;
}
示例4: save
public function save()
{
$token = $this->input->post('token', TRUE);
if ($token != $_SESSION['token']) {
msg_url(L('edit_02'), 'javascript:history.back();');
}
$userinfo['nichen'] = $this->input->post('usernichen', TRUE, TRUE);
$userinfo['email'] = $this->input->post('useremail', TRUE, TRUE);
$userinfo['tel'] = $this->input->post('usertel', TRUE, TRUE);
$userinfo['qq'] = $this->input->post('userqq', TRUE, TRUE);
$userinfo['sex'] = intval($this->input->post('usersex'));
$userinfo['city'] = $this->input->post('usercity', TRUE, TRUE);
$userinfo['qianm'] = $this->input->post('userqianm', TRUE);
if (empty($userinfo['nichen']) || !is_username($userinfo['nichen'], 1)) {
msg_url(L('edit_03'), 'javascript:history.back();');
}
if (empty($userinfo['email']) || !is_email($userinfo['email'])) {
msg_url(L('edit_04'), 'javascript:history.back();');
}
if (empty($userinfo['tel']) || !is_tel($userinfo['tel'])) {
msg_url(L('edit_05'), 'javascript:history.back();');
}
if (!empty($userinfo['qq']) && !is_qq($userinfo['qq'])) {
msg_url(L('edit_06'), 'javascript:history.back();');
}
//判断昵称是否注册
$nichen = $this->db->query("select id from " . CS_SqlPrefix . "user where nichen='" . $userinfo['nichen'] . "' and id!=" . $_SESSION['cscms__id'] . "")->row();
if ($nichen) {
msg_url(L('edit_07'), 'javascript:history.back();');
}
//判断邮箱是否注册
$email = $this->db->query("select id from " . CS_SqlPrefix . "user where email='" . $userinfo['email'] . "' and id!=" . $_SESSION['cscms__id'] . "")->row();
if ($email) {
msg_url(L('edit_08'), 'javascript:history.back();');
}
//判断手机是否注册
$tel = $this->db->query("select id from " . CS_SqlPrefix . "user where tel='" . $userinfo['tel'] . "' and id!=" . $_SESSION['cscms__id'] . "")->row();
if ($tel) {
msg_url(L('edit_09'), 'javascript:history.back();');
}
//修改入库
$this->CsdjDB->get_update('user', $_SESSION['cscms__id'], $userinfo);
msg_url(L('edit_10'), 'javascript:history.back();');
}
示例5: _checkuserinfo
private function _checkuserinfo($data, $is_edit=0) {
if(!is_array($data)){
showmessage(L('need_more_param'));return false;
} elseif (!is_username($data['username']) && !$is_edit){
showmessage(L('username_format_incorrect'));return false;
} elseif (!isset($data['userid']) && $is_edit) {
showmessage(L('username_format_incorrect'));return false;
} elseif (empty($data['email']) || !is_email($data['email'])){
showmessage(L('email_format_incorrect'));return false;
}
return $data;
}
示例6: public_checknickname_ajax
/**
* 检查用户昵称
* @param string $nickname 昵称
* @return $status {0:已存在;1:成功}
*/
public function public_checknickname_ajax()
{
$nickname = isset($_GET['nickname']) && trim($_GET['nickname']) && is_username(trim($_GET['nickname'])) ? trim($_GET['nickname']) : exit('0');
if (CHARSET != 'utf-8') {
$nickname = iconv('utf-8', CHARSET, $nickname);
$nickname = addslashes($nickname);
}
//首先判断会员审核表
$this->verify_db = pc_base::load_model('member_verify_model');
if ($this->verify_db->get_one(array('nickname' => $nickname))) {
exit('0');
}
if (isset($_GET['userid'])) {
$userid = intval($_GET['userid']);
//如果是会员修改,而且NICKNAME和原来优质一致返回1,否则返回0
$info = get_memberinfo($userid);
if ($info['nickname'] == $nickname) {
//未改变
exit('1');
} else {
//已改变,判断是否已有此名
$where = array('nickname' => $nickname);
$res = $this->db->get_one($where);
if ($res) {
exit('0');
} else {
exit('1');
}
}
} else {
$where = array('nickname' => $nickname);
$res = $this->db->get_one($where);
if ($res) {
exit('0');
} else {
exit('1');
}
}
}
示例7: login
public function login()
{
$this->_session_start();
//获取用户siteid
$siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1;
//定义站点id常量
if (!defined('SITEID')) {
define('SITEID', $siteid);
}
if (isset($_POST['dosubmit'])) {
if (empty($_SESSION['connectid'])) {
//判断验证码
$code = isset($_POST['code']) && trim($_POST['code']) ? trim($_POST['code']) : showmessage(L('input_code'), HTTP_REFERER);
if ($_SESSION['code'] != strtolower($code)) {
showmessage(L('code_error'), HTTP_REFERER);
}
}
//echo $_POST['username'];
//die;
$username = isset($_POST['username']) && is_username($_POST['username']) ? trim($_POST['username']) : showmessage(L('username_empty'), HTTP_REFERER);
$password = isset($_POST['password']) && trim($_POST['password']) ? trim($_POST['password']) : showmessage(L('password_empty'), HTTP_REFERER);
$cookietime = intval($_POST['cookietime']);
$synloginstr = '';
//同步登陆js代码
if (pc_base::load_config('system', 'phpsso')) {
$this->_init_phpsso();
$status = $this->client->ps_member_login($username, $password);
$memberinfo = unserialize($status);
//print_r($memberinfo);
//die;
// dprint_r($status);die;
if (isset($memberinfo['uid'])) {
//查询帐号
$r = $this->db->get_one(array('phpssouid' => $memberinfo['uid']));
if (!$r) {
//插入企业详细信息,企业不存在 插入企业
$info = array('phpssouid' => $memberinfo['uid'], 'username' => $memberinfo['username'], 'password' => $memberinfo['password'], 'encrypt' => $memberinfo['random'], 'email' => $memberinfo['email'], 'regip' => $memberinfo['regip'], 'regdate' => $memberinfo['regdate'], 'lastip' => $memberinfo['lastip'], 'lastdate' => $memberinfo['lastdate'], 'groupid' => $this->_get_usergroup_bypoint(), 'modelid' => 10);
//如果是connect用户
if (!empty($_SESSION['connectid'])) {
$userinfo['connectid'] = $_SESSION['connectid'];
}
if (!empty($_SESSION['from'])) {
$userinfo['from'] = $_SESSION['from'];
}
unset($_SESSION['connectid'], $_SESSION['from']);
$this->db->insert($info);
unset($info);
$r = $this->db->get_one(array('phpssouid' => $memberinfo['uid']));
}
$password = $r['password'];
$synloginstr = $this->client->ps_member_synlogin($r['phpssouid']);
} else {
if ($status == -1) {
//用户不存在
showmessage(L('user_not_exist'), 'index.php?m=member&c=index&a=login');
} elseif ($status == -2) {
//密码错误
showmessage(L('password_error'), 'index.php?m=member&c=index&a=login');
} else {
showmessage(L('login_failure'), 'index.php?m=member&c=index&a=login');
}
}
} else {
//密码错误剩余重试次数
$this->times_db = pc_base::load_model('times_model');
$rtime = $this->times_db->get_one(array('username' => $username));
if ($rtime['times'] > 4) {
$minute = 60 - floor((SYS_TIME - $rtime['logintime']) / 60);
showmessage(L('wait_1_hour', array('minute' => $minute)));
}
//查询帐号
$r = $this->db->get_one(array('username' => $username));
if (!$r) {
showmessage(L('user_not_exist'), 'index.php?m=member&c=index&a=login');
}
//验证用户密码
$password = md5(md5(trim($password)) . $r['encrypt']);
if ($r['password'] != $password) {
$ip = ip();
if ($rtime && $rtime['times'] < 5) {
$times = 5 - intval($rtime['times']);
$this->times_db->update(array('ip' => $ip, 'times' => '+=1'), array('username' => $username));
} else {
$this->times_db->insert(array('username' => $username, 'ip' => $ip, 'logintime' => SYS_TIME, 'times' => 1));
$times = 5;
}
showmessage(L('password_error', array('times' => $times)), 'index.php?m=member&c=index&a=login', 3000);
}
$this->times_db->delete(array('username' => $username));
}
//如果用户被锁定
if ($r['islock']) {
showmessage(L('user_is_lock'));
}
$userid = $r['userid'];
$groupid = $r['groupid'];
$username = $r['username'];
$nickname = empty($r['nickname']) ? $username : $r['nickname'];
$updatearr = array('lastip' => ip(), 'lastdate' => SYS_TIME);
//vip过期,更新vip和企业组
//.........这里部分代码省略.........
示例8: register
public function register()
{
$this->_session_start();
//加载用户模块配置
$member_setting = getcache('member_setting');
if (!$member_setting['allowregister']) {
showmessage(L('deny_register'), 'index.php?m=member&c=index&a=login');
}
//获取用户siteid
$siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1;
//定义站点id常量
if (!defined('SITEID')) {
define('SITEID', $siteid);
}
header("Cache-control: private");
if (isset($_POST['dosubmit'])) {
if (empty($_SESSION['connectid']) && $_SESSION['code'] != strtolower($_POST['code'])) {
showmessage(L('code_error'));
}
$userinfo = array();
$userinfo['encrypt'] = create_randomstr(6);
$userinfo['username'] = isset($_POST['username']) && is_username($_POST['username']) ? $_POST['username'] : exit('0');
$userinfo['nickname'] = isset($_POST['nickname']) && is_username($_POST['nickname']) ? $_POST['nickname'] : '';
$userinfo['email'] = isset($_POST['email']) && is_email($_POST['email']) ? $_POST['email'] : exit('0');
$userinfo['password'] = isset($_POST['password']) ? $_POST['password'] : exit('0');
$userinfo['email'] = isset($_POST['email']) && is_email($_POST['email']) ? $_POST['email'] : exit('0');
$userinfo['modelid'] = isset($_POST['modelid']) ? intval($_POST['modelid']) : 10;
$userinfo['regip'] = ip();
$userinfo['point'] = $member_setting['defualtpoint'] ? $member_setting['defualtpoint'] : 0;
$userinfo['amount'] = $member_setting['defualtamount'] ? $member_setting['defualtamount'] : 0;
$userinfo['regdate'] = $userinfo['lastdate'] = SYS_TIME;
$userinfo['siteid'] = $siteid;
$userinfo['connectid'] = isset($_SESSION['connectid']) ? $_SESSION['connectid'] : '';
$userinfo['from'] = isset($_SESSION['from']) ? $_SESSION['from'] : '';
unset($_SESSION['connectid'], $_SESSION['from']);
if ($member_setting['enablemailcheck']) {
//是否需要邮件验证
$userinfo['groupid'] = 7;
} elseif ($member_setting['registerverify']) {
//是否需要管理员审核
$userinfo['modelinfo'] = isset($_POST['info']) ? array2string($_POST['info']) : '';
$this->verify_db = pc_base::load_model('member_verify_model');
unset($userinfo['lastdate'], $userinfo['connectid'], $userinfo['from']);
$this->verify_db->insert($userinfo);
showmessage(L('operation_success'), 'index.php?m=member&c=index&a=register&t=3');
} else {
//查看当前模型是否开启了短信验证功能
$model_field_cache = getcache('model_field_' . $userinfo['modelid'], 'model');
if (isset($model_field_cache['mobile']) && $model_field_cache['mobile']['disabled'] == 0) {
$mobile = $_POST['info']['mobile'];
if (!preg_match('/^1([0-9]{10})/', $mobile)) {
showmessage(L('input_right_mobile'));
}
$sms_report_db = pc_base::load_model('sms_report_model');
$posttime = SYS_TIME - 300;
$where = "`mobile`='{$mobile}' AND `posttime`>'{$posttime}'";
$r = $sms_report_db->get_one($where);
if (!$r || $r['id_code'] != $_POST['mobile_verify']) {
showmessage(L('error_sms_code'));
}
}
$userinfo['groupid'] = $this->_get_usergroup_bypoint($userinfo['point']);
}
if (pc_base::load_config('system', 'phpsso')) {
$this->_init_phpsso();
$status = $this->client->ps_member_register($userinfo['username'], $userinfo['password'], $userinfo['email'], $userinfo['regip'], $userinfo['encrypt']);
if ($status > 0) {
$userinfo['phpssouid'] = $status;
//传入phpsso为明文密码,加密后存入phpcms_v9
$password = $userinfo['password'];
$userinfo['password'] = password($userinfo['password'], $userinfo['encrypt']);
$userid = $this->db->insert($userinfo, 1);
if ($member_setting['choosemodel']) {
//如果开启选择模型
//通过模型获取会员信息
require_once CACHE_MODEL_PATH . 'member_input.class.php';
require_once CACHE_MODEL_PATH . 'member_update.class.php';
$member_input = new member_input($userinfo['modelid']);
$user_model_info = $member_input->get($_POST['info']);
$user_model_info['userid'] = $userid;
//插入会员模型数据
$this->db->set_model($userinfo['modelid']);
$this->db->insert($user_model_info);
}
if ($userid > 0) {
//执行登陆操作
if (!$cookietime) {
$get_cookietime = param::get_cookie('cookietime');
}
$_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
$cookietime = $_cookietime ? TIME + $_cookietime : 0;
if ($userinfo['groupid'] == 7) {
param::set_cookie('_username', $userinfo['username'], $cookietime);
param::set_cookie('email', $userinfo['email'], $cookietime);
} else {
$phpcms_auth_key = md5(pc_base::load_config('system', 'auth_key') . $this->http_user_agent);
$phpcms_auth = sys_auth($userid . "\t" . $userinfo['password'], 'ENCODE', $phpcms_auth_key);
param::set_cookie('auth', $phpcms_auth, $cookietime);
param::set_cookie('_userid', $userid, $cookietime);
param::set_cookie('_username', $userinfo['username'], $cookietime);
//.........这里部分代码省略.........
示例9: check
public function check()
{
$field = $this->input->get_post('field', TRUE, TRUE);
//需要查询的字段
$data = $this->input->get_post('param', TRUE, TRUE);
//需要查询的字段
if (empty($field) || empty($data)) {
exit('{"status":"n","info":"' . get_bm(L('reg_27')) . '"}');
}
//判断保留用户名
$ymext = explode('|', Home_Ymext);
if ($field == 'name' && in_array($data, $ymext)) {
exit('{"status":"n","info":"' . get_bm(L('reg_28')) . '"}');
}
//判断用户名格式
if ($field == 'name' && !is_username($data)) {
exit('{"status":"n","info":"' . get_bm(L('reg_29')) . '"}');
}
//判断邮箱格式
if ($field == 'email' && !is_email($data)) {
exit('{"status":"n","info":"' . get_bm(L('reg_30')) . '"}');
}
//判断手机号码格式
if ($field == 'tel' && !preg_match('/^1([0-9]{9})/', $data)) {
exit('{"status":"n","info":"' . get_bm(L('reg_31')) . '"}');
}
//判断需要查询的字段是否存在
if (!$this->db->field_exists($field, CS_SqlPrefix . 'user')) {
exit('{"status":"n","info":"' . get_bm(L('reg_32')) . '"}');
}
//查询数据库
$row = $this->CsdjDB->get_row('user', 'id', $data, $field);
if ($row) {
exit('{"status":"n","info":"' . get_bm(L('reg_33')) . '"}');
} else {
exit('{"status":"y","info":""}');
}
}
示例10: account_manage_info
public function account_manage_info()
{
if (isset($_POST['dosubmit'])) {
//更新用户昵称
$nickname = isset($_POST['nickname']) && is_username(trim($_POST['nickname'])) ? trim($_POST['nickname']) : '';
if ($nickname) {
$this->db->update(array('nickname' => $nickname), array('userid' => $this->memberinfo['userid']));
if (!isset($cookietime)) {
$get_cookietime = param::get_cookie('cookietime');
}
$_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
$cookietime = $_cookietime ? TIME + $_cookietime : 0;
param::set_cookie('_nickname', $nickname, $cookietime);
}
require_once CACHE_MODEL_PATH . 'member_input.class.php';
require_once CACHE_MODEL_PATH . 'member_update.class.php';
$member_input = new member_input($this->memberinfo['modelid']);
$modelinfo = $member_input->get($_POST['info']);
$this->db->set_model($this->memberinfo['modelid']);
$membermodelinfo = $this->db->get_one(array('userid' => $this->memberinfo['userid']));
if (!empty($membermodelinfo)) {
$this->db->update($modelinfo, array('userid' => $this->memberinfo['userid']));
} else {
$modelinfo['userid'] = $this->memberinfo['userid'];
$this->db->insert($modelinfo);
}
showmessage(L('operation_success'), HTTP_REFERER);
} else {
$memberinfo = $this->memberinfo;
//获取会员模型表单
require CACHE_MODEL_PATH . 'member_form.class.php';
$member_form = new member_form($this->memberinfo['modelid']);
$this->db->set_model($this->memberinfo['modelid']);
$membermodelinfo = $this->db->get_one(array('userid' => $this->memberinfo['userid']));
$forminfos = $forminfos_arr = $member_form->get($membermodelinfo);
//万能字段过滤
foreach ($forminfos as $field => $info) {
if ($info['isomnipotent']) {
unset($forminfos[$field]);
} else {
if ($info['formtype'] == 'omnipotent') {
foreach ($forminfos_arr as $_fm => $_fm_value) {
if ($_fm_value['isomnipotent']) {
$info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
}
}
$forminfos[$field]['form'] = $info['form'];
}
}
}
$formValidator = $member_form->formValidator;
include template('member', 'account_manage_info');
}
}
示例11: define
<?php
/*
四川省扶贫和移民工作局
*/
define('IN_ADMIN', True);
require 'include/common.php';
$do = getGP('do', 'G');
if (check_submit('dosubmit')) {
$errmsg = array();
initGP(array('username', 'password', 'vdcode', 'remember'), 'P');
if (strlen($username) < 3 || strlen($username) > 50) {
$errmsg[] = '用户名长度必须在3-20字节之间。';
} elseif (!is_username($username)) {
$errmsg[] = '用户名中含有非法字符。';
}
if (strlen($password) < 6) {
$errmsg[] = '密码长度不能小于6个字节。';
}
if (get_config('user', 'login_vdcode')) {
session_start();
if (strtolower($vdcode) != $_SESSION['vdcode']) {
$errmsg[] = '验证码不正确。';
}
unset($_SESSION['vdcode']);
}
if (count($errmsg)) {
show_msg($errmsg, 'login.php');
}
$flag = $_USER->login($username, $password, $remember);
if ($flag == 1) {
示例12: exit
<?php
!defined('DEBUG') and exit('Access Denied.');
include './xiunophp/image.func.php';
$action = param(1);
$user = user_read($uid);
user_login_check($user);
if (empty($action) || $action == 'profile') {
if ($method == 'GET') {
$header['title'] = '个人中心';
include './flarum/view/my_profile.htm';
} else {
$username = param('username');
$email = param('email');
!is_username($username, $err) and message(1, $err);
!is_email($email, $err) and message(2, $err);
$update = array();
if ($username != $user['username']) {
mb_strlen($username, 'UTF-8') > 32 and message(1, '用户名 最长为 32 个字符。');
$u = user_read_by_username($username);
$u and message(1, '用户名已经存在,更换其它名字试试。');
$update['username'] = $username;
}
if ($email != $user['email']) {
mb_strlen($email, 'UTF-8') > 40 and message(1, 'EMAIL 最长为 40 个字符。');
$u = user_read_by_email($email);
$u and message(2, 'Email 已经存在,更换其它 Email 试试。');
$update['email'] = $email;
}
if ($update) {
$r = user_update($uid, $update);
示例13: reg_save
public function reg_save()
{
//注册开关
if (User_Reg == 0) {
msg_url(L('reg_35'), Web_Path);
}
if (!isset($_SESSION['denglu__id'])) {
msg_url(L('open_09'), spacelink('login'));
}
$token = $this->input->post('token', TRUE);
if ($token != $_SESSION['token']) {
msg_url(L('open_16'), 'javascript:history.back();');
}
$userpass2 = $this->input->post('repassword', TRUE, TRUE);
$userinfo['code'] = random_string('alnum', 6);
$userinfo['name'] = $this->input->post('username', TRUE, TRUE);
$userinfo['pass'] = $this->input->post('userpass', TRUE, TRUE);
$userinfo['nichen'] = $this->input->post('usernichen', TRUE);
$userinfo['email'] = $this->input->post('useremail', TRUE, TRUE);
$userinfo['tel'] = $this->input->post('usertel', TRUE, TRUE);
$userinfo['regip'] = getip();
$userinfo['cion'] = User_Cion_Reg;
$userinfo['jinyan'] = User_Jinyan_Reg;
$userinfo['addtime'] = time();
$userinfo['yid'] = 0;
if ($userinfo['nichen'] == "0") {
$userinfo['nichen'] = '';
}
if (!is_username($userinfo['name'])) {
msg_url(L('reg_04'), 'javascript:history.back();');
}
if (!is_userpass($userinfo['pass'])) {
msg_url(L('reg_05'), 'javascript:history.back();');
}
if ($userinfo['pass'] != $userpass2) {
msg_url(L('reg_34'), 'javascript:history.back();');
}
if (!empty($userinfo['nichen']) && !is_username($userinfo['nichen'], 1)) {
msg_url(L('reg_06'), 'javascript:history.back();');
}
if (!is_email($userinfo['email'])) {
msg_url(L('reg_07'), 'javascript:history.back();');
}
//判断保留用户名
$ymext = explode('|', Home_Ymext);
if (in_array($userinfo['name'], $ymext)) {
msg_url(L('reg_08'), 'javascript:history.back();');
}
//判断同一IP注册时间限制
if (User_RegIP > 0) {
$row = $this->db->query("SELECT addtime FROM " . CS_SqlPrefix . "user where regip='" . $userinfo['regip'] . "' order by id desc")->row();
if ($row && $row->addtime + 3600 * User_RegIP > time()) {
msg_url(L('reg_09'), 'javascript:history.back();');
}
}
//判断用户名是否注册
$username = $this->CsdjDB->get_row('user', 'id', $userinfo['name'], 'name');
if ($username) {
msg_url(L('reg_10'), 'javascript:history.back();');
}
//判断邮箱是否注册
$useremail = $this->CsdjDB->get_row('user', 'id', $userinfo['email'], 'email');
if ($useremail) {
msg_url(L('reg_11'), 'javascript:history.back();');
}
//下面选填字段
$userinfo['qq'] = $this->input->post('userqq', TRUE);
$userinfo['sex'] = intval($this->input->post('usersex', TRUE));
$userinfo['city'] = $this->input->post('usercity', TRUE);
$userinfo['skins'] = Home_Skins;
$userinfo['qianm'] = '';
if (!empty($userinfo['tel'])) {
if (!is_tel($userinfo['tel'])) {
msg_url(L('reg_12'), 'javascript:history.back();');
}
//判断手机号码是否注册
$usertel = $this->CsdjDB->get_row('user', 'id', $userinfo['tel'], 'tel');
if ($usertel) {
msg_url(L('reg_13'), 'javascript:history.back();');
}
}
//判断手机强制验证
if (User_Tel == 1) {
if (empty($userinfo['tel'])) {
msg_url(L('reg_12'), 'javascript:history.back();');
}
$telcode = intval($this->input->post('telcode', TRUE));
if ($telcode == 0 || $telcode != $_SESSION['tel_code']) {
msg_url(L('reg_14'), 'javascript:history.back();');
}
}
//是否需要人工验证
if (User_RegFun == 1) {
$userinfo['yid'] = 1;
$title = L('reg_15');
}
//是否需要邮件验证
if (User_RegEmailFun == 1) {
$userinfo['yid'] = 2;
$title = L('reg_16', array($userinfo['email']));
//.........这里部分代码省略.........
示例14: _validate_userinfo
private function _validate_userinfo(&$data)
{
if (isset($data['username'])) {
$data['username'] = strtolower(trim($data['username']));
if (!is_username($data['username'])) {
return '用户名不合法';
}
}
if (isset($data['email'])) {
$data['email'] = strtolower(trim($data['email']));
if (!$data['email']) {
return 'Email不合法';
}
}
if (isset($data['phone'])) {
$data['phone'] = (int) $data['phone'];
if (!is_phone($data['phone'])) {
return '手机号不合法';
}
}
if (isset($data['password'])) {
if (!is_password($data['password'])) {
return '密码不合法';
}
}
if (isset($data['qq'])) {
$data['qq'] = (int) $data['qq'];
!is_qq($data['qq']) && ($data['qq'] = 0);
}
isset($data['wechat']) && !is_wechat($data['wechat']) && ($data['wechat'] = '');
return true;
}
示例15: template_out
template_out('message_send.html', $modul_name);
exit;
}
if ($action == "submit_send") {
$username = c_trim($_POST['username']);
$text = html2bb($_POST['text']);
$user_array = explode(",", $_POST['username']);
$subject = c_trim($_POST['subject']);
$pri = intval($_POST['pri']);
if (!$username || !$text || !$subject) {
show_error('ln_message_1', $modul_name);
exit;
}
for ($i = 0; $i < count($user_array); $i++) {
$userid_c = get_userid($user_array[$i]);
if (!is_username($user_array[$i])) {
show_error('ln_users_e_1', $modul_name);
exit;
}
$db->query("INSERT INTO cc" . $n . "_messages (username,fromuserid,touserid,text,time,isnew,inbox,subject,pri) VALUES ('" . $userdata['username'] . "','" . $userdata['userid'] . "','" . $userid_c . "','" . mysql_real_escape_string($text) . "','" . time() . "','1','1','" . mysql_real_escape_string($subject) . "','" . $pri . "')");
}
header("LOCATION: message.php");
exit;
}
if ($action == "lookup") {
$pmid = intval($_GET['pmid']);
$result = $db->query("SELECT * FROM cc" . $n . "_messages WHERE touserid='" . $userdata['userid'] . "' AND pmid='{$pmid}'");
$row = $db->fetch_array($result);
if ($row['pmid'] != $pmid) {
show_error('ln_message_e_notfound', $modul_name);
exit;