<html>
<head><title>pwgen: a password generator</title>
<link rel="stylesheet" type="text/css" href="desert.css">
<script>
function set_secure(yesno)
{
    if (yesno)
    {	
	// if secure is checked, uncheck the other boxes
	document.pwgenform.capitalize.checked = false;
	document.pwgenform.numerals.checked = false;
    } else {
	// if another was checked, uncheck secure.
	document.pwgenform.secure.checked = false;
    }
}
</script>
</head>
<body>
<h1>pwgen</h1>
<form method="post" name="pwgenform">
<input type="checkbox" name="capitalize" value="yes" onclick="javascript:set_secure(false)"
<?php if ($capitalize=="yes") print "CHECKED"?>>
Include at least one capital letter in the password<br>
<input type="checkbox" name="numerals" value="yes" onclick="javascript:set_secure(false)"
<?php if ($numerals=="yes") print "CHECKED"?>>
Include at least one number in the password<br>
<input type="checkbox" name="secure" value="yes" onclick="javascript:set_secure(true)"
<?php if ($secure=="yes") print "CHECKED"?>>
Generate completely random passwords<br>
<input type="submit" value="Generate Passwords">
</form>

<pre>
<?php
$pwgen_options = "-C";
$pwgen = "/usr/bin/pwgen";
if ($capitalize == "yes")
{
    $pwgen_options .= " --capitalize";
} else {
    # this is default, but for completeness...
    $pwgen_options .= " --no-capitalize";    
}
if ($numerals == "yes")
{
    $pwgen_options .= " --numerals";
} else {
    # this is default, but for completeness...
    $pwgen_options .= " --no-numerals";
}
if ($secure == "yes") 
{
    $pwgen_options .= " --secure";
}
print htmlentities( `$pwgen $pwgen_options` );
?>
</pre>
</body></html>
<?
#    pwgen.php - generate passwords using pwgen
#    Copyright (C) 2003  Hans Fugal
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
?>
