Hi,
I am new to PHP and programming for that matter, I have been working on generating random passwords.
I have created a form and php file to generate passwords.
I would like to take the generation 1 step further by using a text file containing CSV seperated words as my string.
Rather than pulling random letters from a string, pull random words from the csv file to build the passwords.
The code I am using to build my strings and randomly build the passwords is:
if($charseta == 1)
$charsetatouse = '23456789';
if($charsetb == 1)
$charsetbtouse = 'abcdefghijkmnpqrstuvwxyz';
if($charsetc == 1)
$charsetctouse = 'ABCDEFGHJKMNOPRSTUVWXYZ';
$charsettouse .= $charsetatouse;
/ echo "$charsettouse<br>"; /
$charsettouse = $charsetbtouse . $charsetatouse;
/ echo "$charsettouse<br>"; /
$charsettouse .= $charsetctouse;
/ echo "$charsettouse<br><br>"; /
/ Random Password Generation for Login /
function random_char($string)
{
$length = strlen($string);
$position = mt_rand(0, $length - 1);
return($string[$position]);
}
function random_string ($charset_string, $length)
{
$return_string = "";
for ($x = 0; $x <$length; $x++)
$return_string .= random_char($charset_string);
return($return_string);
}
mt_srand((double)microtime() * 5000000);
$charset = $charsettouse;
How could I incoporate a csv text file in my code above??
Any help or pointers would be greatfully received.
Thanks in Advance
GeneB