UCenter 批量添加用户的php代码
2012-07-17 00:00
831 查看
<? //作者:www.tongqiong.com //header("content-type:text/html; charset=utf-8"); //include_once("include/config.php"); //include_once("include/db_mysql.inc.php"); ////include_once("include/n_public_function.php"); //$db = new DB_MYSQL("localhost","dbh218710","root","123"); include_once('./common.php'); include_once(S_ROOT.'./data/data_magic.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <? global $_SGLOBAL;//定义全局变量 //注册的用户名 $rando_first_name = array( '哪里购物', '同穷论坛', '台州妈妈', '7788黑客' ); //注册的密码 $rando_first_password = array( '15032x', '103716', '114517', '1ggg17' ); /*为了确保用户名和密码能对上号,输出个字的数组长度进行比较 echo count($rando_first_name); echo "______"; echo count($rando_first_password); exit; */ for($i=0;$i<count($rando_first_name);$i++){ $username = $rando_first_name[$i]; $pwd1 = $rando_first_password[$i]; $salt = substr(uniqid(rand()), -6); $pwd = md5(md5($pwd1).$salt); //查询是否已存在此用户名 $sql_username = "select username from uc_members where username='".$username."'"; $s_name = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query($sql_username)); //如果不存在重名的用户 if($username != $s_name['username']){//如果不存在 $_SGLOBAL['db']->query("INSERT INTO uc_members (username, password,regdate,salt) VALUES ('$username', '$pwd','".mktime()."','$salt')"); $sql = "select uid from uc_members where username='".$username."'"; $_SGLOBAL['db']->query($sql); $uuu = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query($sql)); echo $uuu['uid']; $_SGLOBAL['db']->query("INSERT INTO uc_memberfields (uid) VALUES ('".$uuu['uid']."')"); echo $username."success<br/>"; }else{ echo "您要添加的用户已添加!"; } } //作者:www.tongqiong.com ?> </body> </html>
相关文章推荐
- php批量激活ucenter中的用户到Discuz x2.5论坛应用中
- UCenter 批量添加用户
- [李景山php] 20170505深入理解PHP内核[读书笔记]--第二章:用户代码执行-1
- phpcms-v9】后台content模块的content.php控制器文件分析-后台添加内容代码分析
- 利用shell实现批量添加用户
- php图片添加文字水印实现代码
- Treeview动态添加用户控件传值和取值的实例代码
- [李景山php] 深入理解PHP内核[读书笔记]--第二章:用户代码执行--SAPI概述-1
- shell批量添加用户、whiledo
- php下获取Discuz论坛登录用户名、用户组、用户ID等信息的实现代码
- linux- 批量添加用户
- jQuery——添加用户并 批量删除
- php批量去除bom的代码
- shell应用之批量添加用户实例
- shell 批量添加用户、删除用户
- linux中批量添加用户
- 关于在c#中创建用户控件后,winform应用程序在调用中无法通过点击用户控件的子控件为其自动添加事件代码的问题
- php实例 生活便利小代码,拍照后,批量递归缩放目录图片.
- 批量添加用户