UCenter 批量添加用户php

WBOY
Lepaskan: 2016-07-25 09:06:35
asal
1113 orang telah melayarinya
只要把该php放进UCenter目录下,执行就可以了.来源: http://www.tongqiong.com/read.php?tid-27-ds-1.html
  1. //作者:www.tongqiong.com
  2. //header("content-type:text/html; charset=utf-8");
  3. //include_once("include/config.php");
  4. //include_once("include/db_mysql.inc.php");
  5. ////include_once("include/n_public_function.php");
  6. //$db = new DB_MYSQL("localhost","dbh218710","root","123");
  7. include_once('./common.php');
  8. include_once(S_ROOT.'./data/data_magic.php');
  9. ?>
  10. global $_SGLOBAL;//定义全局变量
  11. //注册的用户名
  12. $rando_first_name = array(
  13. '哪里购物',
  14. '同穷论坛',
  15. '台州妈妈',
  16. '7788黑客'
  17. );
  18. //注册的密码
  19. $rando_first_password = array(
  20. '15032x',
  21. '103716',
  22. '114517',
  23. '1ggg17'
  24. );
  25. /*为了确保用户名和密码能对上号,输出个字的数组长度进行比较
  26. echo count($rando_first_name);
  27. echo "______";
  28. echo count($rando_first_password);
  29. exit;
  30. */
  31. for($i=0;$i $username = $rando_first_name[$i];
  32. $pwd1 = $rando_first_password[$i];
  33. $salt = substr(uniqid(rand()), -6);
  34. $pwd = md5(md5($pwd1).$salt);
  35. //查询是否已存在此用户名
  36. $sql_username = "select username from uc_members where username='".$username."'";
  37. $s_name = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query($sql_username));
  38. //如果不存在重名的用户
  39. if($username != $s_name['username']){//如果不存在
  40. $_SGLOBAL['db']->query("INSERT INTO uc_members (username, password,regdate,salt)
  41. VALUES ('$username', '$pwd','".mktime()."','$salt')");
  42. $sql = "select uid from uc_members where username='".$username."'";
  43. $_SGLOBAL['db']->query($sql);
  44. $uuu = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query($sql));
  45. echo $uuu['uid'];
  46. $_SGLOBAL['db']->query("INSERT INTO uc_memberfields (uid)
  47. VALUES ('".$uuu['uid']."')");
  48. echo $username."success
    ";
  49. }else{
  50. echo "您要添加的用户已添加!";
  51. }
  52. }
  53. //作者:www.tongqiong.com
  54. ?>
复制代码


Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan