// Random Password Generator usage: $NewPass = RandPass(); or $NewPass2 = RandPass(6); for 6 char function RandPass($n=8,$chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'){ srand((double)microtime()*1000000); $m=strlen($chars); $i=$n; while(--$i){ $x .= substr($chars,rand() % $m,1); } return $x; } //oneliner function RandPass($n=8,$chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'){srand((double)microtime()*1000000);$m=strlen($chars);$i=$n;while(--$i){$x.=substr($chars,rand()%$m,1);}return $x;}