You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.9 KiB
PHP
52 lines
1.9 KiB
PHP
<?php
|
|
require "config.inc.php";
|
|
require "my_lib.php";
|
|
|
|
$sessid = check_session();
|
|
$sessid_domain = $sessid['domain'];
|
|
$sessid_username = $sessid['username'];
|
|
|
|
print_header("menu");
|
|
|
|
if (!empty($_POST['submit'])) {
|
|
$address = $_POST['address'];
|
|
$goto = $_POST['goto'];
|
|
|
|
$address_value = $address;
|
|
$address = $address . "@" . $sessid_domain;
|
|
|
|
if (empty($address) or empty($goto)) print_error("You will need to fill both fields.");
|
|
|
|
if (!check_email($address)) print_error("The email address that you have supplied at <b>Alias</b> is not a valid email address, please go back.");
|
|
|
|
if (!check_email($goto)) print_error("The email address that you have supplied at <b>To</b> is not a valid email address, please go back.");
|
|
|
|
if ($address_value == "none") $address = "@" . $sessid_domain;
|
|
|
|
$result = db_query("SELECT * FROM alias WHERE address='$address'");
|
|
if ($result['rows'] == 1) print_error("This email address already exists, please choose a different one.");
|
|
|
|
$result = db_query("INSERT INTO alias (address,goto,domain,create_date,change_date) VALUES('$address','$goto','$sessid_domain',NOW(),NOW())");
|
|
if ($result['rows'] == 1) {
|
|
print "<p>\n";
|
|
print "<i>$address</i> -> <i>$goto</i> has been <b>added</b> to the alias table!\n";
|
|
print "<p>\n";
|
|
} else {
|
|
print_error("Unable to add: <i>$address</i> -> <i>$goto</i> to the alias table!");
|
|
}
|
|
}
|
|
?>
|
|
Create a new alias for your domain.
|
|
<p>
|
|
<form name="alias" method="post">
|
|
<table class="form">
|
|
<tr><td>Alias:</td><td><input type="text" name="address"></td><td>@<?php print "$sessid_domain" ?></td></tr>
|
|
<tr><td>To:</td><td><input type="text" name="goto"></td><td>Where the mail needs to be send to.<br>Use "edit" in the overview to add more<br>then one email address.</td></tr>
|
|
<tr><td colspan="3" align="center"><input type="submit" name="submit" value="Add Alias"></td></tr>
|
|
</table>
|
|
</form>
|
|
If you want to add a catchall enter "none" in the alias field.
|
|
<?php
|
|
print_footer();
|
|
?>
|