Revision: 65333
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 20, 2013 15:05 by luckygreentiger
Initial Code
/* a function to create passwords for new users or password resets. standard
disclaimers apply. not promised to work. take the code as-is. if you like, find
errors, or use please let me know at luckygreentiger at gmail */
function randomPassword($maxLength) {
$possible = "#0123456789+bBcCdDfFgGhHjJkKmMnNpPqQrRsStTvVwWxXyYzZ-";
if($maxLength == "") {
$maxLength = 12;
}
while(($beat < $maxLength) && (strlen($possible) > 0)) {
$beat++;
// get rand character from possibles
$character = substr($possible, mt_rand(0, strlen($possible)-1), 1);
// delete selected char from possible choices
$possible = str_replace($character, "", $possible);
$password .= $character;
}
return $password;
}
Initial URL
Initial Description
A function to create passwords for new users or password resets.
Initial Title
Function to generate random passwords
Initial Tags
php
Initial Language
PHP