/*------------------------------------------------------ */
//-- 快速添加会员
/*------------------------------------------------------ */
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 快速添加会员的更多相关文章

  1. Android Studio快速添加Gson以及GsonFormat的使用

    目录: 一.Android Studio快速添加Gson 二.Android Studio中GsonFormat的使用 三.在线JSON校验格式化工具 一.Android Studio快速添加Gson ...

  2. Centos系统快速添加yum源

    我常用的yum源如下: 阿里云yum源:http://mirrors.aliyun.com/repo/Centos-7.repo 小红帽yum源:https://dl.fedoraproject.or ...

  3. 一、CnPack源码模板功能快速添加注释

    Delphi通过CnPack源码模板功能,能快速添加注释,非常之好用,使用方法如下图: 1.选择CnPack的源码模板专家 2.设置Pacal标准过程头 3.设置内容如下,并且设置了Ctrl+W的快捷 ...

  4. Openstack(十五)快速添加新计算节点

    当后期添加新物理服务器作为计算节点,如果按照上面的过程安装配置的话会非常的慢,但是可以通过复制配置文件的方式快速添加. 15.1计算节点服务安装 #提前将yum仓库.防火墙.selinux.主机名.时 ...

  5. 【转】在Visual Studio中怎样快速添加代码段

    原文网址:http://blog.csdn.net/yl2isoft/article/details/9735527 以前一直只知道,键入prop,再按两次tab键,会生成自动属性代码. 今天闲着无事 ...

  6. Android Studio快速添加Gson Gsonformat

    一.Android Studio快速添加Gson 具体操作:       1.File->Project Structure: 2.app->Dependencies->" ...

  7. dedecms--后台添加会员栏目(批量添加)

    最近在用dedecms二次开发会员功能,一开始做了一个会员添加,但是领导要求可以批量添加,最好是可以输入添加个数:这样我想添加几个就添加几个了 1:会员添加的htm页面 <html> &l ...

  8. Mac OS X 快速添加新文件

    本文为 automator (中文名为 自动操作)的练习之作,尚有许多不足. 如果你想在 OS X 系统中快速添加新文件可直接参考此文 简介 本文使用 automator 创建了一个应用程序 auto ...

  9. IDEA 创建类是自动添加注释和创建方法时快速添加注释

    1.创建类是自动添加注释 /*** @Author: chiyl* @DateTime: ${DATE} ${TIME}* @Description: TODO*/2. 创建方法时快速添加注释2.1 ...

随机推荐

  1. JAVA file文件操作

    /** *文件重命名 * @param oldname 原来的文件名 * @param newname 新文件名 */ @RequestMapping("renameFile") ...

  2. 【POJ 2187】Beauty Contest 凸包+旋转卡壳

    xuán zhuǎn qiǎ ké模板题 是这么读吧(≖ ‿ ≖)✧ 算法挺简单:找对踵点即可,顺便更新答案. #include<cstdio> #include<cstring&g ...

  3. js类型转换的坑

    JS的灵活 说好听是说JS灵活, 说不好听就是JS的坑太多, JS类型转换就是一个大坑, JS的类型包括了原始类型的[null, undefined, String ,Number, Boolean] ...

  4. 哈希 poj 1480

    计算可能的数目 a3*x3^3+a4*x4^3+a5*x5^5=-(a1*x1^3+a2*x2^3); 列举右边的  结果存到数组  z[i] 和为i的右边等式的数目 如果和小于0  +2500000 ...

  5. Freemarker 各种格式化

    1.格式化日期 ${updated?string("yyyy-MM-dd HH:mm:ss")} 如果指定的变量不一定存在,可以这样: ${(dateMap.beginTime?s ...

  6. java基础3.0:Java常用API

    本篇介绍Java基础中常用API使用,当然只是简单介绍,围绕重要知识点引入,巩固开发知识,深入了解每个API的使用,查看JavaAPI文档是必不可少的. 一.java.lang包下的API Java常 ...

  7. Ajax工作原理(转)

    1.ajax技术的背景 不可否认,ajax技术的流行得益于google的大力推广,正是由于google earth.google suggest以及gmail等对ajax技术的广泛应用,催生了ajax ...

  8. shell 字符串截取

    ${expression}一共有9种使用方法. ${parameter:-word},如果parameter为空,则用word的值做parameter的缺省值 ${parameter:=word},在 ...

  9. 【POJ 1182】食物链(并查集)

    三种动物,A吃B,B吃C,C吃A.那么用并查集时,还要多一个x和根的关系,吃或者被吃或者同类.合并两个需要更新和祖先的关系.这个关系可以自己画一画. #include<cstdio> #d ...

  10. python 常用内置函数

    编译,执行 repr(me)                          # 返回对象的字符串表达 compile("print('Hello')",'test.py','e ...