<?php
/* Passwort-Generator */

if(isset($_GET["all"])){
/* Passwort Generierung */
$length = ($_GET["length"])?$_GET["length"]:8;
$type = ($_GET["all"])?1:0;

	$c[0] = 33;
	$c[1] = 35;
	$c[2] = 36;
	$c[3] = 37;
	$c[4] = 38;
	$c[5] = 42;
	$c[6] = 43;
	$c[7] = 44;
	$c[8] = 45;
	$c[9] = 46;
	$c[10] = 47;
	$c[11] = 48;
	$c[12] = 49;
	$c[13] = 50;
	$c[14] = 51;
	$c[15] = 52;
	$c[16] = 53;
	$c[17] = 54;
	$c[18] = 55;
	$c[19] = 56;
	$c[20] = 57;
	$c[21] = 58;
	$c[22] = 59;
	$c[23] = 60;
	$c[24] = 61;
	$c[25] = 62;
	$c[26] = 63;
	$c[27] = 64;
	$c[28] = 65;
	$c[29] = 66;
	$c[30] = 67;
	$c[31] = 68;
	$c[32] = 69;
	$c[33] = 70;
	$c[34] = 71;
	$c[35] = 72;
	$c[36] = 73;
	$c[37] = 74;
	$c[38] = 75;
	$c[39] = 76;
	$c[40] = 77;
	$c[41] = 78;
	$c[42] = 79;
	$c[43] = 80;
	$c[44] = 81;
	$c[45] = 82;
	$c[46] = 83;
	$c[47] = 84;
	$c[48] = 85;
	$c[49] = 86;
	$c[50] = 87;
	$c[51] = 88;
	$c[52] = 89;
	$c[53] = 90;
	$c[54] = 95;
	$c[55] = 97;
	$c[56] = 98;
	$c[57] = 99;
	$c[58] = 100;
	$c[59] = 101;
	$c[60] = 102;
	$c[61] = 103;
	$c[62] = 104;
	$c[63] = 105;
	$c[64] = 106;
	$c[65] = 107;
	$c[66] = 108;
	$c[67] = 109;
	$c[68] = 110;
	$c[69] = 111;
	$c[70] = 112;
	$c[71] = 113;
	$c[72] = 114;
	$c[73] = 115;
	$c[74] = 116;
	$c[75] = 117;
	$c[76] = 118;
	$c[77] = 119;
	$c[78] = 120;
	$c[79] = 121;

mt_srand((double)microtime()*1000000);

function pw($l,$a=0)
{
	global $c;
	for($i=0;$i<$l;$i++){
		$p .= chr(($a)?mt_rand(33,127):$c[mt_rand(0,79)]);
	}
	return $p;
}

$i=0;
while($i<$_GET['number'])
{
   $p = pw($length,$type);
   if(strlen(trim($p))==$length)
   {
      echo htmlentities($p).'<br>';
      $i++;
   }
}

}else{

/* Eingabemaske */
?><html>
<head><title>Passwort-Generator</title></head>
<body><form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="GET">
<input type="hidden" name="abgeschickt" value="ja">
Länge<input type="text" name="length" value="8"><br>
ASCII 33-127 <input type="radio" name="all" value="1">
 Ausgewählte Zeichen <input type="radio" name="all" value="0"><br>
Anzahl <input type="text" name="number"><br>
<input type="submit">
</form></body>
</html><?php
}
?>







