PHP generates usernames and passwords randomly. Automatically generate a username (6-13 characters in length) functioncreate_password ($ pw_length4) {$ randpwd; for ($ i0; $ I $ pw_length; $ I ++) {$ randpwd. chr (mt_rand (33,126);} re // automatically generate a random user name for the user (length: 6-13)
Function create_password ($ pw_length = 4 ){
$ Randpwd = '';
For ($ I = 0; $ I <$ pw_length; $ I ++ ){
$ Randpwd. = chr (mt_rand (33,126 ));
}
Return $ randpwd;
}
Function generate_username ($ length = 6 ){
// Password character set, which can be any character you need
$ Chars = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789! @ # $ % ^ & * ()-_ [] {}<> ~ '+ = ,.;:/? | ';
$ Password = '';
For ($ I = 0; $ I <$ length; $ I ++)
{
// Two character acquisition methods are provided here
// Use substr to intercept any character in $ chars;
// The second method is to take any element of the character array $ chars.
// $ Password. = substr ($ chars, mt_rand (0, strlen ($ chars)-1), 1 );
$ Password. = $ chars [mt_rand (0, strlen ($ chars)-1)];
}
Return $ password;
}
// Call this function
$ UserId = 'user'. generate_username (6 );
$ Pwd = create_password (9 );
From Hurry's column
Functions create_password ($ pw_length = 4) {$ randpwd =; for ($ I = 0; $ I $ pw_length; $ I ++) {$ randpwd. = chr (mt_rand (33,126);} re...