Two random password generation functions:
Function 1:
Function Randompassword ( $ Passwordlength = 8 )
{
$ Str = " Abcefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz " ;
If ( $ Passwordlength > Strlen ( $ Str ))
$ Passwordlength = Strlen ( $ Str );
If ( $ Passwordlength < 8 )
$ Passwordlength = 8 ;
$ Start = Mt_rand ( 1 , ( Strlen ( $ Str ) - $ Passwordlength ));
$ String = Str_shuffle ( $ Str );
$ Password = Substr ( $ String , $ Start , $ Passwordlength );
Return ( $ Password );
}
Function 2: Function Randompassword ( $ Passwordlength = 8 )
{
// Password string
Define ( " Pass_string " , " Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789 " );
If ( $ Passwordlength < 8 )
$ Passwordlength = 8 ;
For ( $ I = 1 ; $ I <= $ Passwordlength ; $ I ++ )
{
$ Randomposition = Rand ( 0 , Strlen (Pass_string) - 1 );
$ Password . = Substr (Pass_string , $ Randomposition , 1 );
}
Return $ Password ;
}