howdy, yo's!
i am working on a small project for a friend. what i am trying to do is create 100 15 digit passwords then insert them (100 passwords) into the database. as it stands now.. only 1 letter/number is being inserted, instead of the full 15 digits.
heres what i have so far:
this is my config.php page that holds most of the variables
<?
//*************************************************
// ONLY CHANGE THIS INFORMATION
//*************************************************
$user = "***"; // database username
$pass = "***"; // database password
$db = "***"; // database name
$table = "randompass"; // table name you choose
//*************************************************
// ONLY CHANGE THIS INFORMATION
//*************************************************
$global = ""; // add nothing here
$link = mysql_connect ("localhost", $user, $pass); // connects to your server with the supplied username and password
$add_table = "CREATE TABLE ".$tablename." ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `passwordII` CHAR(30) NOT NULL )";
if (!$link) // if it cannot connect...
die("Couldnt connect to MySQL"); // ...return a fail message
mysql_select_db ($db, $link) // connects to your database
or die ("Coudlnt open $db: ".mysql_error()); // returns a fail message if it can not connect
?>
and this is my do_dbinput.php file:
<?
//*****************************************
// DO NOT CHANGE ANYTHING IN THIS FILE
//*****************************************
include ("config.php"); // includes the code written in your config.php file.
for ($y = 0; $y < 100; $y++){ // generates 100 15 digit passwords
for ($z = 0; $z < 15; $z++){ // generates 1 15 digit password
$password = array (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0);
shuffle ($password); // shuffles the above ^^ array
echo $password[$z]; // returns the shuffled array only using the first 15 digits
}
$insert_password = "INSERT INTO ".$table."(passwordII) values ('$password[$z]')";
mysql_query ($insert_password, $link) // executes the 'CREATE TABLE' command
or die ("Couldnt add passwords to the database"); // returns a message if it couldnt not add the new table
echo ("<br>"); // extra code commented out so it doesnt run
}
echo ("\n");
?>
any ideas as to why only 1 letter/number is be written?
thanks ya'll