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_id']) && get_client_name($_POST['client_id'], $mysqli)) { // set the client_id variable from POST $client_id = $_POST['client_id']; $client_name = get_client_name($client_id, $mysqli); // check if the client has attached domains if (get_client_domain_count($client_id, $mysqli) && ($domain_tables = get_domains_table($client_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 Client</legend>\n\t\t\t\t\n\t\t\t\t" . quickalert("warning", $client_name . " is the owner of one or more domains.") . "\n\t\t\t\t\n\t\t\t\t" . quickalert("info", "To delete this client, you can either delete all \n\t\t\t\t\tassociated domains and their transport maps, or \n\t\t\t\t\tchange the owner of any domain to another client. \n\t\t\t\t\t<a class='alert-link' href=" . SITE_URL . "/?do=list&object=domain&id=" . $client_id . "'>View Domain(s)</a>") . "\n\t\t\t\t\n\t\t\t\t" . $domain_tables . "\n\t\t\t\t\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } elseif (get_client_domain_count($client_id, $mysqli)) { 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'];
// are you logged in? if (!isset($_SESSION['username'])) { gohome(); } // are you in the correct group? if ($_SESSION['role_id'] < 1) { errormsg('Your role does not have access to this resource'); } else { if (isset($_GET['id'])) { // get client name if ID exists if (get_client_name($_GET['id'], $mysqli)) { $client_id = $_GET['id']; $client_name = get_client_name($client_id, $mysqli); } if ($domain_tables = get_domains_table($client_id, $mysqli)) { // domains! echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\n\t\t\t<h2>Domains for " . $client_name . "</h2>\n\t\t\t<p>\n\t\t\t\t<a class='btn success' href=" . SITE_URL . "/?do=create&object=domain><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a>\n\t\t\t\t<a class='btn info' href=" . SITE_URL . "/?do=list&object=domain><span class='glyphicon glyphicon-th-list' id='logIcon'></span> List All </a>\n\t\t\t<p>\n\t\t\t" . $domain_tables . "\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } else { //no domains! echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\n\t\t\t<h2>Domains for " . $client_name . "</h2>\n\t\t\t<div class='alert alert-error'><p>There are currently no domains in the database for " . $client_name . ".</p></div>\n\t\t\t<p>\n\t\t\t\t<a class='btn success' href=" . SITE_URL . "/?do=create&object=domain><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a>\n\t\t\t\t<a class='btn info' href=" . SITE_URL . "/?do=list&object=domain><span class='glyphicon glyphicon-th-list' id='logIcon'></span> List All </a>\n\t\t\t<p>\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } } else { if ($domain_tables = get_domains_table(false, $mysqli)) { // domains! echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\n\t\t\t<h2>Domains</h2>\n\t\t\t<p>\n\t\t\t\t<a class='btn success' href=" . SITE_URL . "/?do=create&object=domain><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a>\n\t\t\t<p>\n\t\t\t" . $domain_tables . "\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } else { //no domains! echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\n\t\t\t<h2>Domains</h2>\n\t\t\t<div class='alert alert-error'><p>There are currently no domains in the database for " . $client_name . ".</p></div>\n\t\t\t<p>\n\t\t\t\t<a class='btn success' href=" . SITE_URL . "/?do=create&object=domain><span class='glyphicon glyphicon-plus-sign' id='logIcon'></span> Create </a>\n\t\t\t\t<a class='btn info' href=" . SITE_URL . "/?do=list&object=domain><span class='glyphicon glyphicon-th-list' id='logIcon'></span> List All </a>\n\t\t\t<p>\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } } }