PHP function generate password

This is something i use quite a lot in many webaplis

function genpass ($length=6){
 $password = "";  $possible = "0123456789bcdfghjkmnpqrstvwxyzQWERTYUIOPASDFGHJKLZXCVBNM";
 $i = 0; while ($i < $length) {
  $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
  if (!strstr($password, $char)) { $password .= $char;$i++;}
 }
 return $password;
}

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word