]> git.wh0rd.org - tt-rss.git/commitdiff
go back to previous make_password()
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 25 Jan 2012 06:47:32 +0000 (10:47 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 25 Jan 2012 06:47:32 +0000 (10:47 +0400)
include/functions.php

index a4e19a23179a95dfcf04ceab569a57ceebf2ac9c..415047458e9997382b28b91877bf7ba5a54b00a0 100644 (file)
 
        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