note 74442 added to function.mt-rand
| From: | earlsinclair2001 at yahoo dot com | Date: | Wed, 11 Apr 2007 17:46:06 +0000 |
| Subject: | note 74442 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125303@lists.php.net to get a copy of this message | ||
Here's my shot at writing a secure password generator function:
<?php
function passwordgenerator()
{
$password = "";
$loop = 0;
while ($loop < 12)
{
$randomchar = chr(mt_rand(35, 126));
if (!strstr($password, $randomchar))
{
$password .= $randomchar;
$loop++;
}
}
return $password;
}
----
Server IP: 64.71.164.2
Probable Submitter: 70.150.142.226
----
Manual Page -- http://www.php.net/manual/en/function.mt-rand.php
Edit -- https://master.php.net/note/edit/74442
Del: integrated -- https://master.php.net/note/delete/74442/integrated
Del: useless -- https://master.php.net/note/delete/74442/useless
Del: bad code -- https://master.php.net/note/delete/74442/bad+code
Del: spam -- https://master.php.net/note/delete/74442/spam
Del: non-english -- https://master.php.net/note/delete/74442/non-english
Del: in docs -- https://master.php.net/note/delete/74442/in+docs
Del: other reasons-- https://master.php.net/note/delete/74442
Reject -- https://master.php.net/note/reject/74442
Search -- https://master.php.net/manage/user-notes.php