/*------------------------------------------------------ */
//-- 快速添加会员
/*------------------------------------------------------ */
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. [转] easyui 获取数据表格中选中行的数据 Get selected row data from...

    原文地址:http://my.oschina.net/meSpace/blog/41463 http://www.easyui.net/2010/06/easyui-tutorial-get-sele ...

  2. Kernel Methods (4) Kernel SVM

    (本文假设你已经知道了hard margin SVM的基本知识.) 如果要为Kernel methods找一个最好搭档, 那肯定是SVM. SVM从90年代开始流行, 直至2012年被deep lea ...

  3. 51nod 1441 欧拉筛法

    1441 士兵的数字游戏 题目来源: CodeForces 基准时间限制:6 秒 空间限制:131072 KB 分值: 40 难度:4级算法题  收藏  关注 两个士兵正在玩一个游戏,游戏开始的时候, ...

  4. Spring 在web 容器中的启动过程

    1.对于一个web 应用,其部署在web 容器中,web 容器提供其一个全局的上下文环境,这个上下文就是 ServletContext ,其后面的spring IoC 容器提供宿主环境 2.在web. ...

  5. python面试2

    Python语言特性 1 Python的函数参数传递 看两个例子:     1 2 3 4 5 a = 1 def fun(a):     a = 2 fun(a) print a  # 1 1 2 ...

  6. js截取文件的名称

    var str = 'aaa.fda.asp'; var arr = str.split('.');//通过\分隔字符串,成字符串数组 var last= arr[arr.length - 1];// ...

  7. C++标准库简介、与STL的关系。

    转自http://www.cnblogs.com/xiongjiaji/archive/2011/06/22/2476490.html C++标准库的所有头文件都没有扩展名.C++标准库的内容总共在5 ...

  8. 【BZOJ-3931】网络吞吐量 最短路 + 最大流

    3931: [CQOI2015]网络吞吐量 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 1228  Solved: 524[Submit][Stat ...

  9. XCode显示iOS Simulators时不显示系统版本号并出现Identifier(UUID)

    如果出现如下的显示问题,说明你添加了多个相同系统版本的iOS Simulators: 打开Windows->Devices,查看已经出现了相同版本的模拟器: 那么我们删除一些相同的模拟器,即可解 ...

  10. Spring MVC exception - Invoking request method resulted in exception : public static native long java.lang.System.currentTimeMillis()

    最近在线上系统发现下面的异常信息: 2014-10-11 11:14:09 ERROR [org.springframework.web.servlet.mvc.annotation.Annotati ...