From: Andrew Dolgov Date: Wed, 25 Jan 2012 06:47:32 +0000 (+0400) Subject: go back to previous make_password() X-Git-Tag: 1.5.10~32 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=85db62133fb8949546b94bcc616b9308ceb9a75c;p=tt-rss.git go back to previous make_password() --- diff --git a/include/functions.php b/include/functions.php index a4e19a23..41504745 100644 --- a/include/functions.php +++ b/include/functions.php @@ -818,7 +818,20 @@ function make_password($length = 8) { - return substr(bin2hex(get_random_bytes($length / 2)), 0, $length); + $password = ""; + $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ"; + + $i = 0; + + while ($i < $length) { + $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); + + if (!strstr($password, $char)) { + $password .= $char; + $i++; + } + } + return $password; } // this is called after user is created to initialize default feeds, labels