/ Published in: PHP
URL: http://mark.haktstudios.com/
A simple php function to generate random passwords between 8-14 characters long. Good for temporary passwords for use with a password recovery system as reset passwords.
Expand |
Embed | Plain Text
function gen_pass() { // load up our valid character string $chars = '01234567890'; $chars .= 'abcdefghijklmnopqrstuvwxyz'; $chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $chars .= '~!@#$%^&*()_+{}[]|/?<>,.'; // set password legnth between 8 and 14 characters long // initialize password & counter $pass = ''; $i = 0; while ($i < $len) { // get a new character // ensure all characters are different { $pass .= $new_char; $i++; } } return $pass; }
You need to login to post a comment.
