PHPBuilder - mkpasswd

RSS Twitter


by: Benjamin Smith
November 13, 2001

Version: 1.02

Type: Function

Category: Other

License: GNU General Public License

Description: This function seeks to mimic the mkpasswd script that comes with the 'expect' progrom found at . A random password is generated using the the parameters specified. You can specify the length of the password, the minimum number of alphabets, numbers and symbols it can have, exclude character types, specify allowable symbols, letter case.

list($usec,$sec)=explode(" ",microtime());
mt_srand($sec * $usec);
function MkPassword($length=10)
 $possible='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz098765432$              $return='';
 for ($i=0; $i<$length; $i++)
   $key=mt_rand(0, strlen($possible)-1);
 return $return;

Comment and Contribute

Your comment has been submitted and is pending approval.

Benjamin Smith



(Maximum characters: 1200). You have characters left.