/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function create_password($pw_length = 8, $use_caps = true, $use_numeric = true, $use_specials = true) { $num_specials = 0; $reg_length = $pw_length; for ($ch = 97; $ch <= 122; $ch++) $chars[] = $ch; // create a-z if ($use_caps) for ($ca = 65; $ca <= 90; $ca++) $caps[] = $ca; // create A-Z if ($use_numeric) for ($nu = 48; $nu <= 57; $nu++) $numbers[] = $nu; // create 0-9 if ($use_specials) { $num_specials = $pw_length - $reg_length; if ($num_specials > 5) $num_specials = 5; for ($si = 33; $si <= 47; $si++) $signs[] = $si; foreach ($rs_keys as $rs) { } } foreach ($rand_keys as $rand) { } }