PHP Password Generating
This script allows random passwords to be generated of any required length with any combination of characters.
Randomly generated password: 7mb5j2m3
The code
function genPwd($length=6) { $password = ''; $possible = '23456789bcdfghjkmnpqrstvwxyz'; $i = 0; while ($i < $length) { $password .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } return $password; }
Usage
Copy and paste the above function into your page and then call the genPwd() function.
$password = genPwd(8);
If no length parameter is set then a default length of 6 will be used. The $possible variable within the function code can be edit to allow or disallow certain characters.




