複製代碼 代碼如下:
//作者: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
?>
http://www.bkjia.com/PHPjc/325628.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325628.htmlTechArticle複製代碼 代碼如下: ? //作者:www.tongqiong.com //header("content-type:text/html; charset=utf-8"); //include_once("include/config.php"); //include_once("include/db_mysql.in...