Random password generator with PHP
function generate_password($length=”) { $str=’abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_?/:(){}[]0123456789′; $max=strlen($str); $length=@round($length); if(empty($length)){$length=rand(8,12);} $password=”; for($i=0; $i<$length; $i++){$password.=$str{rand(0,$max-1)};} return $password; } In the above code the PHP function generate_password() takes one optional argument, the length of the password. If you do not specify the length then this function will return a random password of length from eight to twelve characters. PHP variavle … [Read more…]