UCenter adds php code for users in batches. Copy the code as follows :? Author: www. tongqiong. comheader (content-type: texthtml; charsetutf-8); include_once (includeconfig. php); include_once (includedb_mysql.in
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; // defines global variables.
// Registered user name
$ Rando_first_name = array (
'Where to shop ',
'Same as the poor BBS ',
'Taizhou Mame ',
'1970 hackers'
);
// Registered password
$ Rando_first_password = array (
'15032x ',
'123 ',
'123 ',
'1ggg17'
);
/* To ensure that the user name and password can match the upper number, the array length of the output characters is compared.
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 );
// Query whether the user name already exists
$ SQL _username = "select username from uc_members where username = '". $ username ."'";
$ S_name = $ _ SGLOBAL ['DB']-> fetch_array ($ _ SGLOBAL ['DB']-> query ($ SQL _username ));
// If the user with the same name does not exist
If ($ username! = $ S_name ['username']) {// if it does not exist
$ _ 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
?>
The http://www.bkjia.com/PHPjc/325628.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325628.htmlTechArticle code is as follows :? // By: www.tongqiong.com // header ("content-type: text/html; charset = utf-8"); // include_once ("include/config. php "); // include_once (" include/db_mysql.in...