您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關使用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中批量添加用戶就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。