UCenter batch add users php

WBOY
Release: 2016-07-25 09:06:35
Original
1048 people have browsed it
Just put the php into the UCenter directory and execute it. Source: http://www.tongqiong.com/read.php?tid-27-ds-1.html
  1. //Author: 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;//Define global variables
  11. //Registered user name
  12. $rando_first_name = array(
  13. 'Where to shop',
  14. 'Tongqiong Forum',
  15. 'Taizhou Mom',
  16. '7788 Hacker '
  17. );
  18. //Registered password
  19. $rando_first_password = array(
  20. '15032x',
  21. '103716',
  22. '114517',
  23. '1ggg17'
  24. );
  25. /* ensure user The name and password can be compared with the last number and the array length of the output words
  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. //Query whether this username already exists
  36. $sql_username = "select username from uc_members where username='" .$username."'";
  37. $s_name = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query($sql_username));
  38. //If there is no duplicate name User
  39. if($username != $s_name['username']){//If it does not exist
  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 "The user you want to add has been added! ";
  51. }
  52. }
  53. //Author: www.tongqiong.com
  54. ?>
Copy code


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!