当前位置:Gxlcms > PHP教程 > UCenter批量添加用户的php代码_PHP教程

UCenter批量添加用户的php代码_PHP教程

时间:2021-07-01 10:21:17 帮助过:46人阅读

代码如下:
  1. <br><!--? <BR-->//作者:www.tongqiong.com <br>//header("content-type:text/html; charset=utf-8"); <br>//include_once("include/config.php"); <br>//include_once("include/db_mysql.inc.php"); <br>////include_once("include/n_public_function.php"); <br>//$db = new DB_MYSQL("localhost","dbh218710","root","123"); <br>include_once('./common.php'); <br>include_once(S_ROOT.'./data/data_magic.php'); <br>?> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <br><title></title> <br> <br> <br><!--? <BR-->global $_SGLOBAL;//定义全局变量 <br>//注册的用户名 <br>$rando_first_name = array( <br>'哪里购物', <br>'同穷论坛', <br>'台州妈妈', <br>'7788黑客' <br>); <br>//注册的密码 <br>$rando_first_password = array( <br>'15032x', <br>'103716', <br>'114517', <br>'1ggg17' <br>); <br>/*为了确保用户名和密码能对上号,
输出个字的数组长度进行比较
echo count($rando_first_name);
echo "______";
echo count($rando_first_password);
exit;
*/
for($i=0;$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
";
}else{
echo "您要添加的用户已添加!";
}
}
//作者:www.tongqiong.com
?>


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/325628.htmlTechArticle 代码如下:

  1. ? //作者:www.tongqiong.com //header("content-type:text/html; charset=utf-8"); //include_once("include/config.php"); //include_once("include/db_mysql.in...<p></p>

人气教程排行