Re: Random Password Generator
| From: | Brian C. Doyle | Date: | Tue, 13 Jun 2000 18:56:43 +0000 |
| Subject: | Re: Random Password Generator | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1741@lists.php.net to get a copy of this message | ||
This is what I am using and it works rather well
<?
function password($length=8)
{
/*
** Set pool of possible characters
*/
$Pool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
$Pool .= "abcdefghijklmnopqrstuvwxyz";
for($index = 0; $index < $length; $index++)
{
$sid .= substr($Pool,
(rand()%(strlen($Pool))), 1);
}
return($sid);
}
// Seed the generator
srand(time());
$passwd = password(8);
?>
I hope this helps
At 09:49 PM 6/13/00 +0200, Svetlin Simeonov wrote:
Hi guys, is there anyone have a good solution for random password generator ? I think something about this $newpass = ""; $string = "ABCDabcd1234"; for ($i=0; $i<8; $i++ ) { $newpass.= substr(rand(0,sizeof($string)),1,$string); } -------------------------------------------------------- Unfortunatly no one can be told what the MATRIX is ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net