0 ? $_REQUEST['pswlen'] : 10;



print "
\n"; print "Make me the .htpasswd-file entry for a user named and\n"; print "a random password with a length of characters or the password \n"; print "\n"; print ""; print "
\n"; print "\n"; $_REQUEST['p'] = ($_REQUEST['wantedpsw'] ? trim($_REQUEST['wantedpsw']) : genpassword($_REQUEST['pswlen'])); if (strlen($_REQUEST['p'])<3) { print "A password only ". strlen($_REQUEST['p']) ." character". (strlen($_REQUEST['p'])!=1 ? 's' : '') ." long? Quite ridiculous, isn't it?\n\n"; } print "To login as «" . $_REQUEST['u'] . "» with ". ( $_REQUEST['p'] ? 'your ' : 'the suggested ') . "password «" . $_REQUEST['p'] . "» you should add the line\n"; print "
" . $_REQUEST['u'] . ":". crypt($_REQUEST['p'],substr($u,0,2)) ."
"; print "to your .htpasswd file.\n"; print "\n"; print "A sample .htaccess file might look likes this:\n"; print "
"; print "AuthUserFile /var/www/karltoffel.de/htdocs/.htpasswd\n"; print "AuthName \"This is a protected page\"\n"; print "AuthType Basic\n"; print "Require valid-user\n"; print "\n"; print "<FilesMatch .ht*>\n"; print " Order allow,deny\n"; print " Allow from none\n"; print " Deny from all\n"; print "</FilesMatch>\n"; print "
"; print "See Apache docs for details: require, mod_access, FilesMatch, htaccess-files etc.\n"; print "\n\n"; print "A note on password generation:\n"; print "Passwords are made from: " . join (",",$all_of_them) . "\n"; print "For obvious reason the letters/numbers O0l1 will not be used.\n"; ?>
View source: fancy or plain