Home  >  Article  >  Backend Development  >  UCenter adds users' php codes in batches_PHP tutorial

UCenter adds users' php codes in batches_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:17:43707browse

Copy code The code is as follows:

//Author: 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;//Define global variables
//Registered user name
$rando_first_name = array(
'Where to shop',
'Tongqiong Forum',
'Taizhou Mom',
'7788 Hacker'
);
//Registered password
$rando_first_password = array(
'15032x ',
'103716',
'114517',
'1ggg17'
);
/*In order to ensure that the username and password can be matched, output the array lengths of the characters for comparison
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);
//Query whether this username already exists
$sql_username = "select username from uc_members where username= '".$username."'";
$s_name = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query($sql_username));
// If there is no user with the same name
if($username != $s_name['username']){//If there is no user
$_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 "The user you want to add has been added! ";
}
}
//Author: www.tongqiong.com
?>





http://www.bkjia.com/PHPjc/325628.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325628.htmlTechArticleCopy the code as follows: ? //Author: www.tongqiong.com //header("content-type: text/html; charset=utf-8"); //include_once("include/config.php"); //include_once("include/db_mysql.in...
Statement:
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