added function to create random passwords

This commit is contained in:
Roland Gruber 2007-11-05 18:16:29 +00:00
parent 4b985473d8
commit f074634070
1 changed files with 15 additions and 0 deletions

View File

@ -281,6 +281,21 @@ function pwd_is_enabled($hash) {
else return true;
}
/**
* Generates a random password with 12 digits.
*
* @return String password
*/
function generateRandomPassword() {
$list = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_';
$password = '';
for ($i = 0; $i < 12; $i++) {
$rand = $_SESSION['ldap']->new_rand() % 65;
$password .= $list[$rand];
}
return $password;
}
/**
* Returns an array with all Samba 3 domain entries under the given suffix
*