$totalChar = 8; // number of chars in the password
$salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789"; // salt to select chars from
srand((double)microtime()*1000000); // start the random generator
$password=""; // set the inital variable
for ($i=0;$i<$totalChar;$i++) // loop and create password
$password = $password . substr ($salt, rand() % strlen($salt), 1);
echo "Password is " . $password;
?>
[/php]
No comments:
Post a Comment