summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-01-25 10:47:32 +0400
committerAndrew Dolgov <[email protected]>2012-01-25 10:47:32 +0400
commit85db62133fb8949546b94bcc616b9308ceb9a75c (patch)
tree6224ac3032f6c9cba96603d0c1a1f9987bd23f7b /include
parentfdb5769ee0e48e2f375fdc008edd9e8f1b036b41 (diff)
go back to previous make_password()
Diffstat (limited to 'include')
-rw-r--r--include/functions.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/functions.php b/include/functions.php
index a4e19a231..415047458 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