RE: [PHP-GENERAL] Random Password Generator
| From: | Webmaster | Date: | Tue, 13 Jun 2000 19:23:50 +0000 |
| Subject: | RE: [PHP-GENERAL] Random Password Generator | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-1745@lists.php.net to get a copy of this message | ||
Read this article.
http://www.phpbuilder.com/columns/jesus19990502.php3
Eduardo Jordán G.
Webmaster
-----Original Message-----
From: Brian C. Doyle [SMTP:bcdoyle@mindspring.com]
Sent: Tuesday, June 13, 2000 1:57 PM
To: Svetlin Simeonov; PHP LIST
Subject: Re: [PHP-GENERAL] Random Password Generator
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
--
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