From 3532ad23553572ef91a9f079eadc6b7454f0cd3a Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Wed, 12 Apr 2017 19:33:38 -0400 Subject: Improved password recovery mechanism --- inc/functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index 12bf2fc..92343f7 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -84,4 +84,15 @@ function bulletin_mail ($to, $subject, $body) { return 0; } } + +function pwgen ($len) { + $alpha = 'abcdefghijklmnopqrstuvwxyz'; + $alpha .= strtoupper($alpha); + $alpha .= '0123456789'; + $pass = ''; + $alen = strlen($alpha); + for ($i = 0; $i < $len; $i++) + $pass .= $alpha[mt_rand(0, $alen-1)]; + return $pass; +} ?> -- cgit v1.2.3