\n"; if (!empty($_POST[submit])) { $domain = $_POST[domain]; $description = $_POST[description]; $aliases = $_POST[aliases]; if (empty($domain) or empty($description)) { print "
\n"; print "You will need to fill all fields.\n"; print "
\n"; print_footer(); exit; } $result = db_query ("SELECT * FROM domain WHERE domain='$domain'"); if ($result[rows] == 1) { print "
\n"; print "This domain already exists, please choose a different one.\n"; print "
\n"; print_footer(); exit; } $result = db_query ("INSERT INTO domain (domain,description,create_date,change_date) VALUES('$domain','$description',NOW(),NOW())"); if ($result[rows] == 1) { print "$domain has been added to the domain table!\n"; print "
\n"; } else { print "Unable to add: $domain to the domain table!\n"; print "
\n";
print_footer();
exit;
}
if ($aliases == "on") {
$alias_keys = array_keys($default_aliases);
$alias_values = array_values($default_aliases);
for ($i = 0; $i < count($alias_keys); $i++) {
$address = $alias_keys[$i] . "@" . $domain;
$result = db_query ("INSERT INTO alias (address,goto,domain,create_date,change_date) VALUES('$address','$alias_values[$i]','$domain',NOW(),NOW())");
if ($result[rows] == 1) {
print "$address has been added to the alias table!
\n";
} else {
print "Unable to add: $address to the alias table!
\n";
}
}
print "
\n"; } } ?> Create a new domain.
\n"; print_footer(); ?>