#!/usr/local/bin/perl -w

use CGI::Minimal

$accountadmin = "monoadm\@mono.org";

print "Content-type: text/html\n\n";
print "<head>\n";
print "<title>Account Application</title>\n";
print "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"/newweb/mono.css\">\n";
print "</head>\n";
print "<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\" LINK=\"#66DDDD\" VLINK=\"#33BBBB\" ALINK=\"#FFFFFF\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" TOPMARGIN=\"0\" LEFTMARGIN=\"0\">\n";

my $cgi = CGI::Minimal->new;
if ($cgi->truncated) { ## Something very bad happened.. don't continue
    print "Something very bad happened here, please report this to";
    print "monoweb\@mono.org\n";
    print "</body>\n";
    print "</html>\n";
    exit;
}
my ($email) = $cgi->param('email');
my ($account) = $cgi->param('account');
my ($vouch) = $cgi->param('vouch');

if (($email eq "") or ($account eq ""))
{
  print "You need to specify your details\n";
  print "</body>\n";
  print "</html>\n";
  exit;
}


open(MAIL, "| /usr/sbin/sendmail $accountadmin") || die "Couldn't send mail...\n";

if ($vouch eq "YES")
{
print MAIL "Subject: vouch account\n\n";
}
else 
{
print MAIL "Subject: new account\n\n";
}

print MAIL "account:\n";
print MAIL "$account\t$email\n";

#print MAIL "\tAccount name  : $account\n";
#print MAIL "\tEmail Address : $email\n\n";

close MAIL;

print "Your application was successfully processed, you will receive an email with further details in a short while\n";
print "</body>\n";
print "</html>\n";
