#! /usr/bin/perl
require "cgi-lib.pl";

###&ReadParse(*cgi);
&parse_form;

$results = &PrintVariables(%cgi);
sub parse_form {

   # Get the input
   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

   # Split the name-value pairs
   @pairs = split(/&/, $buffer);

   foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);

      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

      $cgi{$name} = $value;
   }
}



# load in the form contents
($nickname = $cgi{'nickname'}) =~ s/\n/ /g;


system ("/newhome/kasra/newstuff/portmaster/kasadd2 $nickname");
system ("mail $nickname\@ezenet.com < /usr/local/etc/httpd/htdocs/pinkfloyd/mailkasadd2.html");

#printf("%s", &PrintHeader); 
print "hi";
  
