#!/usr/bin/perl

print "Content-Type: Text/HTML\n\n";

use CGI ':standard';
use Vpanel 1.00;
require $header;
require $accountinfo;
$domainname = find_domain ($mainuser);
$chosen_user = param ('user');

@validusers = find_valid_users($domainname);
$numusers = @validusers;

# Define the tab which appears to the front
$tab_section = $tabnum_email;

# Output the content associated with this tab
print "<body class=section-$tab_section>";

# display tabs
require $tabdisplay;

print_header ("Creation of a new email address for $domainname");

print "Please select the user you wish this new email address to be connected to and the email address you wish to use:<BR><BR>";

print "<table width=50% class=text>";
print "<form method=post action=/$script_bin/create_address-confirm.pl class=text>";
print "<tr><td width=10%><B>User:</B></td><td><select name=user class=text>";
for $validuser ( @validusers )
{
        $mainuserstring = "$mainuser";
	$spamstring = "^spam";
        if ( !( $validuser =~ /$spamstring/) )
        {
		print "\n<option value=$validuser";
		if ( $chosen_user eq $validuser )
                {
                        print " selected ";
                }
                print ">$validuser";
        }
}
print "</select></td></tr>";

print "<tr><td width=10%><B>Address:</B></td><td><input name=address class=text maxlength=60>\@$domainname</td></tr></table>";

print_end_of_form();

require $footer;
