--- fenglin/lib/passwd.inc.php 2025/03/31 13:58:58 1.2 +++ fenglin/lib/passwd.inc.php 2025/04/29 11:55:32 1.6 @@ -1,7 +1,6 @@ -= 3) - { - return false; - } - } - else - { - $ch[$c] = 1; - } if (is_numeric($c)) { $num_count++; - if ($num_count >= 3) - { - return false; - } } - if (ord($c) >= ord('A') && ord($c) <= ord('Z')) + if (ctype_upper($c)) { $upper_case++; } - if (ord($c) >= ord('a') && ord($c) <= ord('z')) + if (ctype_lower($c)) { $lower_case++; } } - if ($upper_case==0 || $lower_case==0 || $num_count==0) + if ($upper_case == 0 || $lower_case == 0 || $num_count == 0) { return false; } @@ -72,8 +54,6 @@ function gen_passwd($len) $num = mt_rand(0, 61); $str .= chr($num < 10 ? (ord("0") + $num) : ($num < 36 ? (ord("A") + $num - 10) : (ord("a") + $num - 36))); } - + return $str; } - -?>