Ec (2); & lt ;? Originally Zend.com, used by hunter reproducted *: $ new_passwordreturn_password (); example: Generate password: 2X5bjj2z, ERgid62Y, p2sHtDPv * & nbsp; copy the code functionreturn_password () as follows () {s script ec (2); script
// It turns out to be Zend.com, which is produced by hunter reproducted
/*
Usage: $ new_password = return_password ();
Example: generate password: 2X5bjj2z, ERgid62Y, p2sHtDPv
*/
| The Code is as follows: |
|
|
Function return_password (){
// Set password length
$ Pw_length = 8;
// Set ASCII range for random character generation
$ Low_ascii_bound = 50; // "2"
$ Upper_ascii_bound = 122; // "z"
// Exclude special characters and some confusing alphanumerics
Exclude confusion between special characters and letters and numbers
// O, O, 0, I, 1, l etc
$ Notuse = array (96,108,111 );
While ($ I <$ pw_length ){
Mt_srand (double) microtime () * 1000000 );
// Random limits within ASCII table
$ Randnum = mt_rand ($ low_ascii_bound, $ top_ascii_bound );
If (! In_array ($ randnum, $ notuse )){
$ Password = $ password. chr ($ randnum );
$ I ++;
}
}
Return $ password;
} |