'; echo ''; echo ''; echo 'Mail Admin Tool'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; if ($member = new member) { if ($member->is_loggedin()) { echo ''; } } else { echo '
'; echo 'An error happened.. could not load the "member" object'; echo '
'; } echo ''; echo '

Mail Admin Tool

'; echo '
'; echo '
'; if ($member->is_loggedin()) { if (!empty($_GET['page'])) { if ($_GET['page'] == "domains") { require_once('includes/class_domains.php'); if ($domains = new domains) { echo '

Domains

'; echo '

If you delete a domain all Email accounts and aliases on it will be deleted too (exept if you converted the databse to MyISAM, then you have to delete Email accounts and Aliases manually, if you dont know what MyISAM is then you propaply didnt.)

'; echo '

You can see a list of domains, create a new one or delete the old ones below

'; echo '
'; echo '
'; echo ''; echo ' Create'; echo '
'; echo '
'; if (!empty($_GET['create'])) { $new_domain = $domains->db->clean($_POST['domain_name']); if($domains->create_domain($new_domain)) { echo '
'; echo 'The domain has been created, and should be in the list below.'; echo '
'; } else { echo '
'; echo 'Could not create domain, make sure you typed it correctly.. do not include the @'; echo '
'; } } if (!empty($_GET['delete'])) { if (is_numeric($_GET['delete'])) { $delete = $domains->db->clean($_GET['delete']); if ($domains->delete_domain($delete)) { echo '
'; echo 'The domain and all its accounts has been deleted.'; echo '
'; } else { echo '
'; echo 'Could not delete the domain, something went wrong!'; echo '
'; } } } echo '

In database

'; if ($domains->get_all_domains()) { if ($domains->num_domains() > 0){ if (!$domains->echo_domain_list()) { echo '
'; echo 'An error happened.. Could not show the domains!'; echo '
'; } } else { echo 'No domains found'; } } else { echo '
'; echo 'An error happened.. could not get domains from database'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not load the "Domains" object'; echo '
'; } } elseif ($_GET['page'] == "emails") { require_once('includes/class_domains.php'); require_once('includes/class_emails.php'); if ($emails = new emails) { echo '

Email accounts

'; echo '

Here you can delete or add email accounts. You can even reset the password if your users forget them.

'; echo '

Please thoose a domain in the dropdown list you want to modify/view
To reset a password, click the key icon on the left site of the email you want to change it for and input a new password in the field on the right

'; echo '

You can click on a email address to see what aliases has the emails as "Destination"

'; if (!empty($_GET['create'])) { $new_email = $emails->db->clean($_POST['new_email']); $new_password = $emails->db->clean($_POST['new_password']); $new_domainid = $emails->db->clean($_POST['new_domainid']); if($emails->create_email($new_email, $new_password, $new_domainid)) { echo '
'; echo 'The email has been created, and should be in the list below.'; echo '
'; } else { echo '
'; echo 'Could not create email, make sure you typed it correctly.. you have to include the "@" and ".", example: "user@example.com" (without " ")'; echo '
'; } } if (!empty($_GET['reset_password']) && !empty($_POST['new_password'])) { $email_id = $emails->db->clean($_GET['reset_password']); $new_password = $emails->db->clean($_POST['new_password']); if (is_numeric($email_id)) { if ($emails->reset_password($email_id, $new_password)) { echo '
'; echo 'The password has been reset!'; echo '
'; } else { echo '
'; echo 'Something went wrong. the password has not been reset!'; echo '
'; } } } if (!empty($_GET['delete'])) { if (is_numeric($_GET['delete'])) { $delete = $emails->db->clean($_GET['delete']); if ($emails->delete_email($delete)) { echo '
'; echo 'The email and all its aliases has been deleted.'; echo '
'; } else { echo '
'; echo 'Could not delete the email, something went wrong!'; echo '
'; } } } $domainid = 0; if ((!empty($_GET['domainid'])) || (!empty($_POST['domainid']))) { if (!empty($_POST['domainid'])) { $_GET['domainid'] = $_POST['domainid']; } $domainid = $emails->db->clean($_GET['domainid']); if (!is_numeric($domainid)) { $domainid = 0; } } if ($domains = new domains) { if ($domains->get_all_domains()) { if ($domains->num_domains() > 0) { echo '
'; echo 'Show: '; echo '
'; if (!empty($domainid)) { echo '
'; echo '

Create new

'; echo '
'; echo 'Email:
'; echo 'Pass:
'; echo ''; echo ' Create'; echo '
'; echo '
'; echo '

In database

'; if ($emails->num_emails_for_domain($domainid) > 0) { if ($emails->get_emails_for_domain($domainid)){ if (!$emails->echo_email_list($domainid)) { echo '
'; echo 'An error happened.. Could not show the emails!'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not get emails from database'; echo '
'; } } else { echo 'No emails found for that domain'; } } } else { echo 'You have not created any domains yet. Please create one from the Domains page'; } } else { echo '
'; echo 'Could not get domains from database'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not load the "domains" object'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not load the "emails" object'; echo '
'; } } elseif ($_GET['page'] == "aliases") { require_once('includes/class_domains.php'); require_once('includes/class_aliases.php'); if ($aliases = new aliases) { echo '

Aliases

'; echo '

On this page you can view the aliases for a domain, create new ones and delete old ones.

'; echo '

To make a "catch all" alias that redirects everything send to an entire domain to one users, type it like this:
Source: @domain-to-catch.com
Destination: user@to-get-it-all.com

'; echo '

Deleting an alias will not delete any users or domains.
Please choose the domain you want to show the aliases for below

'; if (!empty($_GET['create'])) { $new_source = $aliases->db->clean($_POST['new_source']); $new_destination = $aliases->db->clean($_POST['new_destination']); $new_domainid = $aliases->db->clean($_POST['new_domainid']); if($aliases->create_alias($new_source, $new_destination, $new_domainid)) { echo '
'; echo 'The alias has been created, and should be in the list below.'; echo '
'; } else { echo '
'; echo 'Could not create alias, make sure you typed it correctly.. you have to include the "@" and ".", example: "user@example.com" or "@domain.com" for a catch-all alias (without " ")'; echo '
'; } } if (!empty($_GET['delete'])) { if (is_numeric($_GET['delete'])) { $delete = $aliases->db->clean($_GET['delete']); if ($aliases->delete_alias($delete)) { echo '
'; echo 'The alias and all its aliases has been deleted.'; echo '
'; } else { echo '
'; echo 'Could not delete the alias, something went wrong!'; echo '
'; } } } $domainid = 0; if ((!empty($_GET['domainid'])) || (!empty($_POST['domainid']))) { if (!empty($_POST['domainid'])) { $_GET['domainid'] = $_POST['domainid']; } $domainid = $aliases->db->clean($_GET['domainid']); if (!is_numeric($domainid)) { $domainid = 0; } } $emailid = 0; if (!empty($_GET['emailid'])) { $emailid = $aliases->db->clean($_GET['emailid']); if (!is_numeric($emailid)) { $emailid = 0; } } if ($domains = new domains) { if ($domains->get_all_domains()) { if ($domains->num_domains() > 0) { echo '
'; echo 'Show: '; echo '
'; if (!empty($emailid)) { if ($domainid = $aliases->get_domainid_for_emailid($emailid)) { echo '
'; echo '

Create new

'; echo '
'; echo 'Alias source:
'; echo 'Alias Destination:
'; echo ''; echo ' Create'; echo '
'; echo '
'; echo '

In database

'; if ($email_address = $aliases->get_emailaddress_for_emailid($emailid)) { if ($aliases->num_aliases_for_destinationemail($email_address) > 0) { if ($aliases->get_aliases_for_emaildestination($email_address)) { if (!$aliases->echo_alias_list_for_emaildestination($email_address, $emailid)) { echo '
'; echo 'An error happened.. Could not show the aliases!'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not get aliases from database'; echo '
'; } } else { echo 'No aliases for that email address.'; } } else { echo '
'; echo 'An error happened.. could not get the email address based on the email ID'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not get the domain ID for the emails'; echo '
'; } } elseif (!empty($domainid)) { echo '
'; echo '

Create new

'; echo '
'; echo 'Alias source:
'; echo 'Alias Destination:
'; echo ''; echo ' Create'; echo '
'; echo '
'; echo '

In database

'; if ($aliases->num_aliases_for_domain($domainid) > 0) { if ($aliases->get_aliases_for_domain($domainid)){ if (!$aliases->echo_alias_list($domainid)) { echo '
'; echo 'An error happened.. Could not show the aliases!'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not get aliases from database'; echo '
'; } } else { echo 'No aliases found for that domain'; } } } else { echo 'You have not created any domains yet. Please create one from the Domains page'; } } else { echo '
'; echo 'Could not get domains from database'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not load the "domains" object'; echo '
'; } } else { echo '
'; echo 'An error happened.. could not load the "aliases" object'; echo '
'; } } elseif ($_GET['page'] == "logout") { if ($member->logout()) { echo '
'; echo 'You are now logged out!'; ?> '; } else { echo '
'; echo "The logout failed, you are still logged in!"; echo '
'; } } } else { ?> Welcome!
This site is for editing your mailservers virtual domains, email accounts and aliases

'; echo '

It was made with the ISPmail guide in mind and works on the database created when following the guide.

'; echo '

If you find any errors, or have some improvement, fixes, suggestions then please email me at mat@ssdata.dk

'; echo '

Use the menu top-right to start editing. If you need a search function then use the browsers CTRL+F

'; } } else { if (!empty($_POST['uname']) && !empty($_POST['pword'])) { $uname = $member->db->clean($_POST['uname']); $pword = $member->db->clean($_POST['pword']); if (!$member->login($uname, $pword)) { echo '
Wrong username or password.
'; if (!$member->echo_login_form()) { echo "
Der er sket en fejl, login billedet kunne ikke vises."; } } else { ?> here'; } } else { if (!$member->echo_login_form()) { echo "
Der er sket en fejl, login billedet kunne ikke vises."; } } } echo '
'; echo '
'; echo ''; echo ''; echo ''; ?>