Location: PHPKode > projects > PHPix2 Photo Album > phpix/passgen.php
<html>
<head> <title>Password Generator </title> </head>
<body>
<H1>Password Generator</H1>
<?
$user = $_REQUEST['user'];
$pass = $_REQUEST['pass'];

if (($user == '') || ($pass == ''))
{
  
}
else
{
  mt_srand((double)microtime()*1000000);
  $chars = array_merge(range('a','z'),range('A','Z'),range(0,9));
  for($i=0;$i<9;$i++)
  {
    $salt .= $chars[mt_rand(0,count($chars)-1)];
  }

  $password = crypt($pass,$salt);
  print "Cut and paste the following line into your htpasswd file:<br>\n";
  print "<pre>\n";
  print htmlentities("$user:$password")."\n";
  print "</pre>\n";
  print "<br><br>";
}

?>
<pre>
<form method="post">
Username: <input type='text' name='user' value='<? print $user; ?>'>
Password: <input type='text' name='pass' value=''>
<input type='submit'>
</form>
</pre>
</body>
</html>
Return current item: PHPix2 Photo Album