温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

使用PHP怎么在UCenter中批量添加用户

发布时间:2020-12-19 17:03:05 来源:亿速云 阅读:188 作者:Leah 栏目:开发技术

这篇文章将为大家详细讲解有关使用PHP怎么在UCenter中批量添加用户,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

<? 
//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","dbh318710","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 "您要添加的用户已添加!"; 
} 
} 
?> 
</body> 
</html>

关于使用PHP怎么在UCenter中批量添加用户就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI