Log in / Register
Login to your account
Remember Me
Create an account
Fields marked with an asterisk (*) are required.
Reload Captcha

Генератор случайного пароля в Joomla

Rate this item
(1 Vote)

Функция генератор пароля средствами Joomla.

public static function genRandomPassword($length = 8)
{
    $salt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $base = strlen($salt);
    $makepass = '';
    $random = JCrypt::genRandomBytes($length + 1);
    $shift = ord($random[0]);
    for ($i = 1; $i <= $length; ++$i) {
        $makepass .= $salt[($shift + ord($random[$i])) % $base];
        $shift += ord($random[$i]);
    }
    return $makepass;
}

Leave a comment