12-06-2011, 04:08 PM
PHP Code:
function passgen($len = 5){
$alphau = Array ('A','B','C', 'D', 'F', 'G' ,'H', 'J', 'K', 'L', 'M', 'N','O', 'P', 'Q', 'R', 'S','T', 'U', 'V', 'W', 'X', 'Y','Z' );
$alphal = array('a','b','c','d','f','g','h','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
$misc = array('1','2','3','4','5','6','7','8','9','[',']','{','}','_','^','%','#','@','+','-');
$list = array_merge($alphau,$alphal,$misc);
shuffle($list);
$password = '';
for($i=0;$i<$len;$i++) {
$add = array_rand($list);
$password .= $list[$add];
}
return $password;
}