ecshop 快速添加会员
/*------------------------------------------------------ */
//-- 快速添加会员
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'quick_insert')
{
/* 检查权限 */
admin_priv('users_manage');
$str1_arr = array('','','','','','','','','','');
$str2_arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
$str3_arr = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); $arr = array_merge($str1_arr,$str2_arr,$str3_arr);
$rand = array_rand($arr,); foreach($rand as $k=>$v){
$New_arr[$k] = $arr[$v];
} $username = implode('',$New_arr); // 用户名 $mobile1 = array_rand($str1_arr,); //手机号
$mobile2 = array_rand($str1_arr,);
$mobile_phone = implode('',array_merge($mobile1,$mobile2)); $password = strtolower($username); // 密码 大写字母转小写
$user_money = ''; $email =$username.'@qq.com';
/*******************以上是主要内容 ********************/
$sex = empty($_POST['sex']) ? : intval($_POST['sex']);
$sex = in_array($sex, array(, , )) ? $sex : ;
$birthday = $_POST['birthdayYear'] . '-' . $_POST['birthdayMonth'] . '-' . $_POST['birthdayDay'];
$rank = empty($_POST['user_rank']) ? : intval($_POST['user_rank']);
$credit_line = empty($_POST['credit_line']) ? : floatval($_POST['credit_line']); $users =& init_users(); if (!$users->add_user($username, $password, $email))
{
/* 插入会员数据失败 */
if ($users->error == ERR_INVALID_USERNAME)
{
$msg = $_LANG['username_invalid'];
}
elseif ($users->error == ERR_USERNAME_NOT_ALLOW)
{
$msg = $_LANG['username_not_allow'];
}
elseif ($users->error == ERR_USERNAME_EXISTS)
{
$msg = $_LANG['username_exists'];
}
elseif ($users->error == ERR_INVALID_EMAIL)
{
$msg = $_LANG['email_invalid'];
}
elseif ($users->error == ERR_EMAIL_NOT_ALLOW)
{
$msg = $_LANG['email_not_allow'];
}
elseif ($users->error == ERR_EMAIL_EXISTS)
{
$msg = $_LANG['email_exists'];
}
else
{
//die('Error:'.$users->error_msg());
}
sys_msg($msg, );
} /* 注册送积分 */
if (!empty($GLOBALS['_CFG']['register_points']))
{
log_account_change($_SESSION['user_id'], , , $GLOBALS['_CFG']['register_points'], $GLOBALS['_CFG']['register_points'], $_LANG['register_points']);
} /*把新注册用户的扩展信息插入数据库*/
$sql = 'SELECT id FROM ' . $ecs->table('reg_fields') . ' WHERE type = 0 AND display = 1 ORDER BY dis_order, id'; //读出所有扩展字段的id
$fields_arr = $db->getAll($sql); $extend_field_str = ''; //生成扩展字段的内容字符串
$user_id_arr = $users->get_profile_by_name($username);
foreach ($fields_arr AS $val)
{
$extend_field_index = 'extend_field' . $val['id'];
if(!empty($_POST[$extend_field_index]))
{
$temp_field_content = strlen($_POST[$extend_field_index]) > ? mb_substr($_POST[$extend_field_index], , ) : $_POST[$extend_field_index];
$extend_field_str .= " ('" . $user_id_arr['user_id'] . "', '" . $val['id'] . "', '" . $temp_field_content . "'),";
}
}
$extend_field_str = substr($extend_field_str, , -); if ($extend_field_str) //插入注册扩展数据
{
$sql = 'INSERT INTO '. $ecs->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str;
$db->query($sql);
} /* 更新会员的其它信息 */
$other = array();
$other['credit_line'] = $credit_line;
$other['user_rank'] = $rank;
$other['sex'] = $sex;
$other['birthday'] = $birthday;
$other['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s')); $other['msn'] = isset($_POST['extend_field1']) ? htmlspecialchars(trim($_POST['extend_field1'])) : '';
$other['qq'] = isset($_POST['extend_field2']) ? htmlspecialchars(trim($_POST['extend_field2'])) : '';
$other['office_phone'] = isset($_POST['extend_field3']) ? htmlspecialchars(trim($_POST['extend_field3'])) : '';
$other['home_phone'] = isset($_POST['extend_field4']) ? htmlspecialchars(trim($_POST['extend_field4'])) : '';
//$other['mobile_phone'] = isset($_POST['extend_field5']) ? htmlspecialchars(trim($_POST['extend_field5'])) : '';
$other['mobile_phone'] = $mobile_phone;
$other['user_money'] = $user_money; $db->autoExecute($ecs->table('users'), $other, 'UPDATE', "user_name = '$username'"); /* 记录管理员操作 */
admin_log($_POST['username'], 'add', 'users'); /* 提示信息 */
$link[] = array('text' => $_LANG['go_back'], 'href'=>'users.php?act=list');
sys_msg(sprintf($_LANG['add_success'], htmlspecialchars(stripslashes($_POST['username']))), , $link); }
admin/order_list.htm
<a href="users.php?act=quick_insert" style="padding-left: 20px;">批量添加会员</a>
ecshop 快速添加会员的更多相关文章
- Android Studio快速添加Gson以及GsonFormat的使用
目录: 一.Android Studio快速添加Gson 二.Android Studio中GsonFormat的使用 三.在线JSON校验格式化工具 一.Android Studio快速添加Gson ...
- Centos系统快速添加yum源
我常用的yum源如下: 阿里云yum源:http://mirrors.aliyun.com/repo/Centos-7.repo 小红帽yum源:https://dl.fedoraproject.or ...
- 一、CnPack源码模板功能快速添加注释
Delphi通过CnPack源码模板功能,能快速添加注释,非常之好用,使用方法如下图: 1.选择CnPack的源码模板专家 2.设置Pacal标准过程头 3.设置内容如下,并且设置了Ctrl+W的快捷 ...
- Openstack(十五)快速添加新计算节点
当后期添加新物理服务器作为计算节点,如果按照上面的过程安装配置的话会非常的慢,但是可以通过复制配置文件的方式快速添加. 15.1计算节点服务安装 #提前将yum仓库.防火墙.selinux.主机名.时 ...
- 【转】在Visual Studio中怎样快速添加代码段
原文网址:http://blog.csdn.net/yl2isoft/article/details/9735527 以前一直只知道,键入prop,再按两次tab键,会生成自动属性代码. 今天闲着无事 ...
- Android Studio快速添加Gson Gsonformat
一.Android Studio快速添加Gson 具体操作: 1.File->Project Structure: 2.app->Dependencies->" ...
- dedecms--后台添加会员栏目(批量添加)
最近在用dedecms二次开发会员功能,一开始做了一个会员添加,但是领导要求可以批量添加,最好是可以输入添加个数:这样我想添加几个就添加几个了 1:会员添加的htm页面 <html> &l ...
- Mac OS X 快速添加新文件
本文为 automator (中文名为 自动操作)的练习之作,尚有许多不足. 如果你想在 OS X 系统中快速添加新文件可直接参考此文 简介 本文使用 automator 创建了一个应用程序 auto ...
- IDEA 创建类是自动添加注释和创建方法时快速添加注释
1.创建类是自动添加注释 /*** @Author: chiyl* @DateTime: ${DATE} ${TIME}* @Description: TODO*/2. 创建方法时快速添加注释2.1 ...
随机推荐
- [转]Eclipse工具使用技巧总结
首先推荐一篇非常好的How to use eclipse文章 ,讲的是eclipse使用的方方面面,非常实用,推荐给大家! 一.常用快捷键:Ctrl+F11 运行Ctrl+Shift+/ 在代码窗口中 ...
- 【BZOJ 4456】【UOJ #184】【ZJOI 2016】旅行者
http://www.lydsy.com/JudgeOnline/problem.php?id=4456 http://uoj.ac/problem/184 参考(抄)的晨爷的题解(代码) 对矩形进行 ...
- hdu3410 单调队列
Passing the Message Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- C++强制类型转换操作符 const_cast
const_cast也是一个强制类型转换操作符.<C++ Primer>中是这样描述它的: 1.将转换掉表达式的const性质. 2.只有使用const_cast才能将const性质性质转 ...
- spoj1811 Longest Common Substring
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- body中设置-webkit-scrollbar竖向滚动条,在手机浏览器上无效
暂时无解,如果是chrome的PC模式,滚动条是没有的,但如果是手机模式,滚动条会出现,且无法设置其样式,滚完后会自动消失. 如果设置div这些块元素,完全没问题.
- 保存密码(KeyChain的使用)
1.导入框架Security.framework 2.编写工具类 /* 该工具类只能保存一个用户和密码 */ /* service 一般为 bundle ID */ @interface GLKeyC ...
- GCD XOR, ACM/ICPC Dhaka 2013, UVa12716
不同的枚举方法,效率完全不同.值得记录一下! #include <cstdio> #include <cstring> , count = ; ]; void pre() { ...
- 海边直播目标2017全国初中数学竞赛班课堂测试题解答-The Final
1. 设函数 $f(x) = 2^x(ax^2 + bx + c)$ 满足等式 $f(x+1) - f(x) = 2^x\cdot x^2$, 求 $f(1)$. 解答: 由 $f(x) = 2^x( ...
- MOOCULUS微积分-2: 数列与级数学习笔记 5. Another comparison test
此课程(MOOCULUS-2 "Sequences and Series")由Ohio State University于2014年在Coursera平台讲授. PDF格式教材下载 ...