echo "<html><head>
<meta http-equiv="Content-
Type"
content="text/
html; charset=utf8">
</head><body>
Сгенерировать пароль<br/>" ;
?>
<form method=post>
<input type=text name=length
value="8">
<input type=submit value="ОК">
<form><br>
<?php
function gen( $length )
{
$chars = '
abcdefghijklmnopqrstuvwxyz
1234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZ
';
$password = '';
for( $i = 0 ; $i < $length ; $i ++){ $index = mt_rand ( 0 , strlen ($chars ) - 1);
$password .= $chars [ $index];
}
return $password ;
}
echo gen( 8);
echo "</body></html> "