UCenter 批量添加用户的php代码_PHP
程序员文章站
2024-02-03 21:34:22
...
复制代码 代码如下:
//作者:www.tongqiong.com
//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","dbh218710","root","123");
include_once('./common.php');
include_once(S_ROOT.'./data/data_magic.php');
?>
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$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.tongqiong.com
//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","dbh218710","root","123");
include_once('./common.php');
include_once(S_ROOT.'./data/data_magic.php');
?>
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
$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
?>
推荐阅读
-
UCenter 批量添加用户的php代码_PHP
-
WordPress主题中添加文章列表页页码导航的PHP代码实例_php实例
-
批量获取memcache值并按key的顺序返回的实现代码_PHP
-
php-网站中想让用户修改自己的主页模版,如何保证代码的安全?
-
做了CDN获取用户真实IP的函数代码(PHP与Asp设置方式)_PHP教程
-
批量获取memcache值并按key的顺序返回的实现代码_php技巧
-
批量去除PHP文件中bom的PHP代码
-
WordPress判断用户是否登录的代码_PHP
-
WordPress主题中添加文章列表页页码导航的PHP代码实例_php实例
-
dedecms 批量提取第一张图片最为缩略图的代码(文章+软件)_php实例