<?php include_once dirname(__FILE__) . "/../app/includes/db_connect.php"; include_once dirname(__FILE__) . "/../app/includes/functions.php"; include_once dirname(__FILE__) . "/../app/includes/header.php"; include_once dirname(__FILE__) . "/../app/includes/menuloader.php"; $error = filter_input(INPUT_GET, 'err', $filter = FILTER_SANITIZE_STRING); if (!$error) { $erroralert = quickalert("error", "Oops! An unknown error occurred."); } else { $erroralert = quickalert("error", $error); } echo "\n<!-- Error Division -->\n<div id='content'>\n\t<legend>Something Went Wrong!</legend>\n\t" . $erroralert . "\n<!-- End error Division -->\n</div>\n"; include_once dirname(__FILE__) . "/../app/includes/footer.php";
include_once dirname(__FILE__) . "/../db_connect.php"; include_once dirname(__FILE__) . "/../functions.php"; if (session_status() == PHP_SESSION_NONE) { sec_session_start(); } // are you logged in? if (!isset($_SESSION['username'])) { gohome(); } // are you in the correct group? if ($_SESSION['role_id'] < 2) { errormsg('Your role does not have access to this resource'); } else { if (isset($_POST['client_name'])) { // sanitise variables for security $client_name = filter_input(INPUT_POST, 'client_name', FILTER_SANITIZE_STRING); if (check_client_name_isfree($client_name, $mysqli)) { if (add_client($client_name, $mysqli)) { echo "\n\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t<legend>Create Client</legend>\n\t\t\t\t\t\t\t" . quickalert("success", "New client '" . $client_name . "' has been added to the database.\n\t\t\t\t\t\t\t\t\t<a class='alert-link' href='" . SITE_URL . "/?do=create&object=domain'>Add Domain</a>") . "\n\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { errormsg("Failed to insert new record into the database"); } } else { errormsg("There is already a client called '" . $client_name . "' in the database!"); } } elseif (!$_POST) { echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=create&object=client' method='post' name='create_client'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Create Client</legend>\n\t\t\t\t" . quickalert("info", "Client names must be alphanumeric. They can contain spaces, underscores and dashes.") . "\n\t\t\t\t<div class='form-group'>\n\t\t\t\t <label class='col-md-4 control-label' for='textinput'>Client Name</label> \n\t\t\t\t <div class='col-md-4'>\n\t\t\t\t <input required name='client_name' name='client_name' type='text' placeholder='InternetWigits' pattern='^([a-zA-Z0-9]){3,50}\$' class='form-control input-md'>\n\t\t\t\t <span class='help-block'>Enter the Clients Name Here.</span> \n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t <label class='col-md-4 control-label' for='singlebutton'></label>\n\t\t\t\t <div class='col-md-4'>\n\t\t\t\t <button id='singlebutton' name='singlebutton' class='btn success large' type='submit'><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </button>\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t<!-- End Content Division -->\n\t\t</div>\n\t\t"; } else { errormsg('POST error. Possible missing input.'); } }
errormsg("cannot generate domains table"); } else { // no domains, remove client if (delete_client($client_id, $mysqli)) { echo "\n\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t<legend>Delete Client</legend>\n\t\t\t\t\t\n\t\t\t\t\t" . quickalert("success", "Client '" . $client_name . "' has been removed from the database.") . "\n\t\t\t\t\t\n\t\t\t\t<!-- End Content Division -->\n\t\t\t\t</div>\n\t\t\t\t"; } else { errormsg("Failed to delete record from the database"); } } } elseif (!$_POST) { if (isset($_GET['id'])) { if (get_client_name($_GET['id'], $mysqli)) { $selected_client_id = $_GET['id']; } } echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=delete&object=client' method='post' name='delete_client'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Delete Client</legend>\n\t\t\t\t\n\t\t\t\t" . quickalert("info", "Cannot delete clients until all domains and transport maps are removed.") . "\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Client</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='client_id' name='client_id' class='form-control'>\n\t\t"; $query = "SELECT client_id,client_name FROM clients ORDER BY client_name"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($client_id, $client_name); while ($row = $stmt->fetch()) { if (isset($selected_client_id) && $selected_client_id == $client_id) { echo "<option selected value=" . $client_id . ">" . $client_name . "</option>"; } else { echo "<option value=" . $client_id . ">" . $client_name . "</option>"; } } } else { errormsg("No clients in the database to delete.");
// check if domain is already in use if (check_domain_name_isfree($domain_name, $mysqli)) { // domain is free, lets add it! if (add_domain($domain_name, $client_id, $mysqli)) { echo "\n\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t<legend>Create Domain</legend>\n\t\t\t\t\t\t\t" . quickalert("success", "New domain '" . $domain_name . "' has been added to the database for client '" . $client_name . "'.") . "\n\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { errormsg("Failed to insert new record into the database"); } } else { errormsg("This domain is already in the database!"); } } else { errormsg("This client_id does not exist"); } } elseif (!$_POST) { echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=create&object=domain' method='post' name='create_domain'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Create Domain</legend>\n\t\t\t\t" . quickalert("info", "Domain names must contain a valid fully qualified domain name.") . "\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Client</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='client_id' name='client_id' class='form-control'>\n\t\t\t\t"; $query = "SELECT client_id,client_name FROM clients ORDER BY client_name"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($client_id, $client_name); while ($row = $stmt->fetch()) { echo "<option value=" . $client_id . ">" . $client_name . "</option>"; } } } // free result set $stmt->close(); echo "\n\t\t\t\t\t</select>\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t<div class='form-group'>\n\t\t\t\t <label class='col-md-4 control-label' for='textinput'>Domain Name</label>\n\t\t\t\t <div class='col-md-4'>\n\t\t\t\t <input\n\t\t\t\t \trequired\n\t\t\t\t \ttype='text'\n\t\t\t\t \tname='domain_name'\n\t\t\t\t \tplaceholder='e.g yourbusiness.com.au'\n\t\t\t\t \tclass='form-control input-md'\n\t\t\t\t \tpattern='^[-a-z0-9]{1,63}\\.(ac\\.nz|co\\.nz|geek\\.nz|gen\\.nz|kiwi\\.nz|maori\\.nz|net\\.nz|org\\.nz|school\\.nz|ae|ae\\.org|com\\.af|asia|asn\\.au|auz\\.info|auz\\.net|com\\.au|id\\.au|net\\.au|org\\.au|auz\\.biz|az|com\\.az|int\\.az|net\\.az|org\\.az|pp\\.az|biz\\.fj|com\\.fj|info\\.fj|name\\.fj|net\\.fj|org\\.fj|pro\\.fj|or\\.id|biz\\.id|co\\.id|my\\.id|web\\.id|biz\\.ki|com\\.ki|info\\.ki|ki|mobi\\.ki|net\\.ki|org\\.ki|phone\\.ki|biz\\.pk|com\\.pk|net\\.pk|org\\.pk|pk|web\\.pk|cc|cn|com\\.cn|net\\.cn|org\\.cn|co\\.in|firm\\.in|gen\\.in|in|in\\.net|ind\\.in|net\\.in|org\\.in|co\\.ir|ir|co\\.jp|jp|jp\\.net|ne\\.jp|or\\.jp|co\\.kr|kr|ne\\.kr|or\\.kr|co\\.th|in\\.th|com\\.bd|com\\.hk|hk|idv\\.hk|org\\.hk|com\\.jo|jo|com\\.kz|kz|org\\.kz|com\\.lk|lk|org\\.lk|com\\.my|my|com\\.nf|info\\.nf|net\\.nf|nf|web\\.nf|com\\.ph|ph|com\\.ps|net\\.ps|org\\.ps|ps|com\\.sa|com\\.sb|net\\.sb|org\\.sb|com\\.sg|edu\\.sg|org\\.sg|per\\.sg|sg|com\\.tw|tw|com\\.vn|net\\.vn|org\\.vn|vn|cx|fm|io|la|mn|nu|qa|tk|tl|tm|to|tv|ws|academy|careers|education|training|bike|biz|cat|co|com|info|me|mobi|name|net|org|pro|tel|travel|xxx|blackfriday|clothing|diamonds|shoes|tattoo|voyage|build|builders|construction|contractors|equipment|glass|lighting|plumbing|repair|solutions|buzz|sexy|singles|support|cab|limo|camera|camp|gallery|graphics|guitars|hiphop|photo|photography|photos|pics|center|florist|institute|christmas|coffee|kitchen|menu|recipes|company|enterprises|holdings|management|ventures|computer|systems|technology|directory|guru|tips|wiki|domains|link|estate|international|land|onl|pw|today|ac\\.im|co\\.im|com\\.im|im|ltd\\.co\\.im|net\\.im|org\\.im|plc\\.co\\.im|am|at|co\\.at|or\\.at|ba|be|bg|biz\\.pl|com\\.pl|info\\.pl|net\\.pl|org\\.pl|pl|biz\\.tr|com\\.tr|info\\.tr|tv\\.tr|web\\.tr|by|ch|co\\.ee|ee|co\\.gg|gg|co\\.gl|com\\.gl|co\\.hu|hu|co\\.il|org\\.il|co\\.je|je|co\\.nl|nl|co\\.no|no|co\\.rs|in\\.rs|rs|co\\.uk|org\\.uk|uk\\.net|com\\.de|de|com\\.es|es|nom\\.es|org\\.es|com\\.gr|gr|com\\.hr|com\\.mk|mk|com\\.mt|net\\.mt|org\\.mt|com\\.pt|pt|com\\.ro|ro|com\\.ru|net\\.ru|ru|su|com\\.ua|ua|cz|dk|eu|fi|fr|pm|re|tf|wf|yt|gb\\.net|ie|is|it|li|lt|lu|lv|md|mp|se|se\\.net|si|sk|ac|ag|co\\.ag|com\\.ag|net\\.ag|nom\\.ag|org\\.ag|ai|com\\.ai|com\\.ar|as|biz\\.pr|com\\.pr|net\\.pr|org\\.pr|pr|biz\\.tt|co\\.tt|com\\.tt|tt|bo|com\\.bo|com\\.br|net\\.br|tv\\.br|bs|com\\.bs|bz|co\\.bz|com\\.bz|net\\.bz|org\\.bz|ca|cl|co\\.cr|cr|co\\.dm|dm|co\\.gy|com\\.gy|gy|co\\.lc|com\\.lc|lc|co\\.ms|com\\.ms|ms|org\\.ms|co\\.ni|com\\.ni|co\\.ve|com\\.ve|co\\.vi|com\\.vi|com\\.co|net\\.co|nom\\.co|com\\.cu|cu|com\\.do|do|com\\.ec|ec|info\\.ec|net\\.ec|com\\.gt|gt|com\\.hn|hn|com\\.ht|ht|net\\.ht|org\\.ht|com\\.jm|com\\.kn|kn|com\\.mx|mx|com\\.pa|com\\.pe|pe|com\\.py|com\\.sv|com\\.uy|uy|com\\.vc|net\\.vc|org\\.vc|vc|gd|gs|north\\.am|south\\.am|us|us\\.org|sx|tc|vg|cd|cg|cm|co\\.cm|com\\.cm|net\\.cm|co\\.ke|or\\.ke|co\\.mg|com\\.mg|mg|net\\.mg|org\\.mg|co\\.mw|com\\.mw|coop\\.mw|mw|co\\.na|com\\.na|na|org\\.na|co\\.ug|ug|co\\.za|com\\.ly|ly|com\\.ng|ng|com\\.sc|sc|mu|rw|sh|so|st|club|kiwi|uno|email|ruhr)\$'/>\n\t\t\t\t <span class='help-block'>Enter the Domain Name here</span> \n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t <label class='col-md-4 control-label' for='singlebutton'></label>\n\t\t\t\t <div class='col-md-4'>\n\t\t\t\t\t<button id='singlebutton' name='singlebutton' class='btn success large' type='submit'><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </button>\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t<!-- End Content Division -->\n\t\t</div>\n\t\t"; } else {
$rule = $direction . "\t" . $usedomain . "\t" . $value; if (add_msrule($sequence, $rule, $ruleset, $mysqli)) { if (edit_configchanged("true", $mysqli)) { echo "\n\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t<legend>Create Ruleset Rule</legend>\n\t\t\t\t\t\t" . quickalert("success", "Ruleset Rule created! \n\t\t\t\t\t\t\t\t\t<a class='alert-link' href=" . SITE_URL . "/?do=create&object=msrule&ruleset=" . $ruleset . ">\n\t\t\t\t\t\t\t\t\t<span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create Another? </a>") . "\n\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t</div>\n\t\t\t\t\t"; } } else { errormsg("Failed to insert new record into the database"); } } else { errormsg("There is already a rule in this ruleset at this sequence number in the database!"); } } elseif (!$_POST) { if (isset($_GET['ruleset'])) { $ruleset_default = $_GET['ruleset']; } echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=create&object=msrule' method='post' name='create_ruleset'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Create Ruleset Rule</legend>\n\t\t\t\t" . quickalert("info", "Adding Rulesets is an advanced feature.\n\t\t\t\t\tRead the documentation for the rule before using it in the <a class='alert-link' href='https://www.mailscanner.info/MailScanner.conf.index.html'>MailScanner Configuration Index</a></p>") . "\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Ruleset</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='ruleset' name='ruleset' class='form-control'>\n\t\t\t\t"; $query = "SELECT `option`,SUBSTRING_INDEX(value, '.', 1) AS value FROM `ms_config` WHERE NOT host='confserialnumber' ORDER BY `option`"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($option, $value); while ($row = $stmt->fetch()) { if (isset($ruleset_default) && $ruleset_default == $value) { echo "<option selected value=" . $value . ">" . $option . "</option>"; } else { echo "<option value=" . $value . ">" . $option . "</option>"; } } } }
gohome(); } // are you in the correct group? if ($_SESSION['role_id'] < 2) { errormsg('Your role does not have access to this resource'); } else { if (isset($_POST['host_name']) && isset($_POST['host_alias'])) { // Setup POST data as a new variable $host_name = $_POST['host_name']; $host_alias = $_POST['host_alias']; $host_key = md5(uniqid(rand(), true)); if (!check_host_name_isfree($host_name, $mysqli)) { errormsg("host_name is already in use"); } if (!check_host_alias_isfree($host_alias, $mysqli)) { errormsg("host_alias is already in use"); } if (!check_host_key_isfree($host_key, $mysqli)) { errormsg("host_key is already in use"); } if (add_host($host_name, $host_alias, $host_key, $mysqli)) { echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t<legend>Create Host</legend>\n\t\t\t\t" . quickalert("success", "New host has been added.") . "\t\t\t\t\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } else { errormsg("Failed to insert new record into the database"); } } elseif (!$_POST) { echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=create&object=host' method='post' name='create_host'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Create Host</legend>\n\t\t\t\t" . quickalert("info", "New host will need to be in the same layer2 network segment.") . "\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t <label class='col-md-4 control-label' for='textinput'>Host Address</label>\n\t\t\t\t <div class='col-md-4'>\n\t\t\t\t <input\n\t\t\t\t \trequired\n\t\t\t\t \ttype='text'\n\t\t\t\t \tname='host_name'\n\t\t\t\t \tplaceholder='e.g msc-scanner1.yourdomain.tld'\n\t\t\t\t \tclass='form-control input-md'\n\t\t\t\t \tsize='50'\n\t\t\t\t \tpattern='^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])\$'\n\t\t\t\t >\n\t\t\t\t <span class='help-block'>FQDN or IP address of the host</span> \n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t <label class='col-md-4 control-label' for='textinput'>Host Alias</label> \n\t\t\t\t <div class='col-md-4'>\n\t\t\t\t <input required name='host_alias' name='host_alias' type='text' placeholder='e.g. Scanner1' pattern='^([a-zA-Z0-9]){3,50}\$' class='form-control input-md'>\n\t\t\t\t <span class='help-block'>Enter an Alias for the host</span> \n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t <label class='col-md-4 control-label' for='singlebutton'></label>\n\t\t\t\t <div class='col-md-4'>\n\t\t\t\t\t<button id='singlebutton' name='singlebutton' class='btn success large' type='submit'><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </button>\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t<!-- End Content Division -->\n\t\t</div>\n\t\t"; } else { errormsg('post error and create_transmap page'); } }
echo "\n\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t<legend>Create Transport Map</legend>\n\t\t\t\t\t\t\t" . quickalert("success", "New transport map has been created for '" . $domain_name . "'.") . "\t\t\t\t\n\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { errormsg("Failed to insert new record into the database"); } } } else { errormsg("transport map already exists"); } } elseif (!$_POST) { // for this, id = address_id if (isset($_GET['id'])) { if (get_domain_name($_GET['id'], $mysqli)) { $selected_address_id = $_GET['id']; } } echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=create&object=transmap' method='post' name='create_transmap'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Create Transport Map</legend>\n\t\t\t\t" . quickalert("info", "Transport maps can only be created for a domain without one. i.e. each domain as one transport map only") . "\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Domain</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='address_id' name='address_id' class='form-control'>\n\t\t\t\t"; $query = "\n\t\t\t\t\tSELECT addresses.address_id,addresses.domain \n\t\t\t\t\tFROM addresses \n\t\t\t\t\tLEFT JOIN transports \n\t\t\t\t\tON addresses.address_id=transports.address_id \n\t\t\t\t\tWHERE transports.transport_id IS NULL\n\t\t\t\t\t"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($address_id, $domain); while ($row = $stmt->fetch()) { if (isset($selected_address_id) && $selected_address_id == $address_id) { echo "<option selected value=" . $address_id . ">" . $domain . "</option>"; } else { echo "<option value=" . $address_id . ">" . $domain . "</option>"; } } } else { errormsg('All Domains have transport maps, or there are none to create a transport map for!');
include_once dirname(__FILE__) . "/../functions.php"; if (session_status() == PHP_SESSION_NONE) { sec_session_start(); } // are you logged in? if (!isset($_SESSION['username'])) { gohome(); } // are you in the correct group? if ($_SESSION['role_id'] < 2) { errormsg('Your role does not have access to this resource'); } else { if (isset($_POST['ruleset_id']) && get_ruleset_rule_array($_POST['ruleset_id'], $mysqli)) { if (delete_msrule($_POST['ruleset_id'], $mysqli)) { if (edit_configchanged("true", $mysqli)) { echo "\n\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t<legend>Delete Client</legend>\n\t\t\t\t\t\n\t\t\t\t\t" . quickalert("success", "The selected rule has been removed from the database.") . "\n\t\t\t\t\t\n\t\t\t\t<!-- End Content Division -->\n\t\t\t\t</div>\n\t\t\t\t"; } else { errormsg("Failed to change config modify status to 'true'"); } } else { errormsg("Failed to delete record from the database"); } } elseif (!$_POST) { if (isset($_GET['id'])) { if (get_ruleset_rule_array($_GET['id'], $mysqli)) { $array = get_ruleset_rule_array($_GET['id'], $mysqli); $table = new Jacopo\Bootstrap3Table\BootstrapTable(); $table->setConfig(array("table-hover" => true, "table-condensed" => true, "table-striped" => true)); $table->setHeader(array("Sequence", "Rule", "Ruleset")); $table->addRows($array); }
} else { errormsg("Failed to delete record from the database"); } } else { errormsg("There are transport maps for this domain. Can not remove domain."); } } else { errormsg("Not matching domain_name for this address_id. Already deleted?"); } } elseif (!$_POST) { if (isset($_GET['id'])) { if (get_domain_name($_GET['id'], $mysqli)) { $selected_address_id = $_GET['id']; } } echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=delete&object=domain' method='post' name='delete_domain'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Delete Domain</legend>\n\t\t\t\t\n\t\t\t\t" . quickalert("warning", "Deleting this domain will stop the cluster accepting mail for it from non-relay hosts.") . "\n\t\t\t\t" . quickalert("info", "Cannot delete domains until the associated transport map is removed") . "\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Domain</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='address_id' name='address_id' class='form-control'>\n\t\t"; $query = "\n\t\t\tSELECT addresses.address_id,addresses.domain,addresses.client_id,clients.client_name \n\t\t\tFROM addresses \n\t\t\tLEFT JOIN clients\n\t\t\tON addresses.client_id=clients.client_id\n\t\t\tORDER BY domain\n\t\t"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($address_id, $domain, $client_id, $client_name); while ($row = $stmt->fetch()) { if (isset($selected_address_id) && $selected_address_id == $address_id) { echo "<option selected value=" . $address_id . ">" . $domain . " - " . $client_name . "</option>"; } else { echo "<option value=" . $address_id . ">" . $domain . " - " . $client_name . "</option>"; } } } else { errormsg("No domains in the database to delete.");
$transport_id = $_POST['transport_id']; // get the domain name $domain_name = get_transport_domain($transport_id, $mysqli); // remove transport map if (delete_transport_map($transport_id, $mysqli)) { echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t<legend>Delete Transport Map</legend>\n\t\t\t\t\n\t\t\t\t" . quickalert("success", "Transport map for '" . $domain_name . "' has been removed from the database.") . "\n\t\t\t\t\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } else { errormsg("Failed to delete record from the database"); } } elseif (!$_POST) { if (isset($_GET['id'])) { if (get_transport_domain($_GET['id'], $mysqli)) { $selected_transport_id = $_GET['id']; } } echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=delete&object=transmap' method='post' name='delete_transmap'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Delete Transport Map</legend>\n\t\t\t\t\n\t\t\t\t" . quickalert("warning", "This will stop mail flow for this domain through this cluster.") . "\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Transport Map</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='transport_id' name='transport_id' class='form-control'>\n\t\t"; $query = "\n\t\t\tSELECT transports.transport_id,transports.address,transports.port,addresses.domain \n\t\t\tFROM transports \n\t\t\tLEFT JOIN addresses \n\t\t\tON transports.address_id=addresses.address_id \n\t\t\tORDER BY addresses.domain\n\t\t"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($transport_id, $address, $port, $domain); while ($row = $stmt->fetch()) { if (isset($selected_transport_id) && $selected_transport_id == $transport_id) { echo "<option selected value=" . $transport_id . ">" . $domain . " via " . $address . ":" . $port . "</option>"; } else { echo "<option value=" . $transport_id . ">" . $domain . " via " . $address . ":" . $port . "</option>"; } } } else { errormsg("No transport maps in the database to delete.");
errormsg('Your role does not have access to this resource'); } else { // make the change if (isset($_GET['id']) && isset($_GET['client_id'])) { if (get_client_name($_GET['client_id'], $mysqli)) { $newclient = $_GET['client_id']; } else { errormsg("client_id not valid"); } if (get_domain_name($_GET['id'], $mysqli)) { $address_id = $_GET['id']; if ($oldclient = get_client_id_by_address_id($address_id, $mysqli)) { if ($stmt = $mysqli->prepare("UPDATE `addresses` SET client_id= ? WHERE address_id= ?")) { $stmt->bind_param('ii', $newclient, $address_id); if ($stmt->execute()) { echo "\n\t\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t\t<legend>Change Domain Owner</legend>\n\t\t\t\t\t\t\t\t" . quickalert("success", "Domain owner of '" . get_domain_name($address_id, $mysqli) . "' changed from '" . get_client_name($oldclient, $mysqli) . "' to '" . get_client_name($newclient, $mysqli) . "'") . "\n\t\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t"; } else { errormsg("failed to edit the domain details"); } } } else { errormsg("address_id not valid"); } } else { errormsg("address_id not valid"); } // get some more info } elseif (isset($_GET['id'])) { if (get_domain_name($_GET['id'], $mysqli)) { $address_id = $_GET['id']; if ($client_id = get_client_id_by_address_id($address_id, $mysqli)) {