#!/usr/local/bin/perl ###################################################### # Define Variables $script = 'http://www.sonic.net/cgi/derk/ht'; ##################################################### # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } &do_passwords; &print_page; sub do_passwords { $NAMEA = $FORM{'NAMEA'}; $NAMEB = $FORM{'NAMEB'}; $NAMEC = $FORM{'NAMEC'}; $NAMED = $FORM{'NAMED'}; $PASSA = crypt($FORM{'PASSA'},XX); $PASSB = crypt($FORM{'PASSB'},XX); $PASSC = crypt($FORM{'PASSC'},XX); $PASSD = crypt($FORM{'PASSD'},XX); if ($NAMEA ne "") { $PAIRA = "$NAMEA".":"."$PASSA"; } if ($NAMEB ne "") { $PAIRB = "$NAMEB".":"."$PASSB"; } if ($NAMEC ne "") { $PAIRC = "$NAMEC".":"."$PASSC"; } if ($NAMED ne "") { $PAIRD = "$NAMED".":"."$PASSD"; } } sub print_page { $user = $FORM{'user'}; $MESSAGE = $FORM{'AUTHNAME'}; print "Content-type: text/html\n\n"; print "
\n"; print "Here are your name/password pairs:
\n!;
print qq!Cut and paste them into a text editor. - Do not use "View Source"
\n!;
print qq!$PAIRA
\n!;
print qq!$PAIRB
\n!;
print qq!$PAIRC
\n!;
print qq!$PAIRD
\n!;
print qq!\n \n!;
print qq!Now that the file is in your text editor your cursor should be at the end of the last line of your last name/password pairs, if so, press "enter". Otherwise move your cursor there and press "enter".
Now save the new file as "passwords.txt"
\n!;
print qq!(If you want to add more users later resend the form with new names/passwords\n!;
print qq! and simply paste them onto the end of your passwords file, but remember you need a new line at the end of the file.)\n!;
print qq!
OK - Here is your .htaccess file.
\n!;
print qq!Cut and paste it into a text editor too. - Do not use "View Source".
\n!; print qq!Also be sure to copy the line that says -END under the last limit section - it will cause problems if you don't
\n!; print qq!
\n!; print qq!Next we need to preserve an end line but we need to get rid of "-end"For now, save the file as "htaccess.txt"
\n!; print qq!
When your done \n!; print qq!follow this link\n!; exit; }