微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

UCenter 批量添加用户的php代码

<div class="codetitle"><a style="CURSOR: pointer" data="62441" class="copybut" id="copybut62441" onclick="doCopy('code62441')"> 代码如下:

<div class="codebody" id="code62441">
<?
//作者:www.tongqiong.com
//header("content-type:text/html; charset=utf-8");
//include_once("include/config.PHP");
//includeonce("include/dbMysqL.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"&gt;






<?
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
";
}else{
echo "您要添加用户添加!";
}
}
//作者:www.tongqiong.com
?>


版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐