/ Published in: PHP
This function can be used to generate random passwords with specified length. Also, can use specified list of characters ($index) and generate passwords with only lower or only upper case characters.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function random_password($lenght=6, $text_transform='uppercase') { $index = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //build array } $password = ''; for($i = 0; $i <= $lenght; $i++) { $password .= $signs[$i]; } if($text_transform == 'lowercase') { } elseif($text_transform == 'uppercase') { } else { return $password; } }