Generate random password that includes numbers and letters
<?php
echo password_gen(6,6);
function password_gen($min=6,$max=6){ /*has a default min value of 6
and maximum value of 6*/
$pwd=”"; // to store generated password
for($i=0;$i<rand($min,$max);$i++){
$num=rand(48,122);
if(($num >= 97 && $num <= 122)) $pwd.=chr($num);
else if(($num >= 65 && $num <= 90)) $pwd.=chr($num);
else if(($num >=48 && $num <= 57)) $pwd.=chr($num);
else $i–;
}
return $pwd;
}
?>
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.



Leave a Reply