Web Development
JBlog

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

Rate this item
(0 votes)

Функция генератор пароля средствами 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;
}
edit Last modified on Tuesday, 15 January 2019 19:51
Login to post comments

AM DOX (Joomla 3.x)

MPC (Music Player Component) (Joomla 3.x)

AMGallery (Joomla 3.x)

AMHTML5AUDIO PRO - Audio player

Online Ocenka (Joomla 2.5)

AM Quick Sale (Joomla 3, 4)

AM Lang

AMHTML5AUDIO Lite - Audio player

AMPopup

AM Unite Gallery Plugin

XMap для MPC

AM Parallax Slider (beta)

AMQS Currency Switch