<?php
define(DB_USER,'root');
define(DB_PSSW,'');
define(DB_HOST,'127.0.0.1');
define(DB_NAME,'sg1');
define(USER_TABLE,'keywords');
$DB_CONN = mysql_pconnect(DB_HOST,DB_USER,DB_PSSW) or die("无法连接数据库");
mysql_select_db(DB_NAME,$DB_CONN) or die("数据库不存在");
$numLen=11;
$pwdLen=11;
$c=100;//生成100组卡号密码
$sNumArr=range(0,9);
$sPwdArr=array_merge($sNumArr,range('A','Z'));
$cards=array();
for($x=0;$x< $c;$x++){
$tempNumStr=array();
for($i=0;$i< $numLen;$i++){
$tempNumStr[]=array_rand($sNumArr);
}
$tempPwdStr=array();
for($i=0;$i< $pwdLen;$i++){
$tempPwdStr[]=$sPwdArr[array_rand($sPwdArr)];
}
$cards[$x]['no']=implode('',$tempNumStr);
$cards[$x]['pwd']=implode('',$tempPwdStr);
}
array_unique($cards);
print_r($cards);
?>