Exemplo n.º 1
0
function DTCdeleteAdmin($adm_to_del)
{
    global $pro_mysql_admin_table;
    global $pro_mysql_domain_table;
    global $pro_mysql_vps_table;
    global $pro_mysql_dedicated_table;
    global $pro_mysql_tik_queries_table;
    global $pro_mysql_cronjob_table;
    global $pro_mysql_ssl_ips_table;
    global $conf_demo_version;
    global $conf_mysql_db;
    if (!isFtpLogin($adm_to_del)) {
        echo "Admin to delete is not in correct format line " . __LINE__ . " file " . __FILE__;
        die;
    }
    $adm_query = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******'";
    $result = mysql_query($adm_query) or die("Cannot execute query \"{$adm_query}\" !!!");
    $num_rows = mysql_num_rows($result);
    if ($num_rows != 1) {
        die("User not found for deletion of {$adm_to_del} !!!");
    }
    $row_virtual_admin = mysql_fetch_array($result);
    $the_admin_path = $row_virtual_admin["path"];
    // delete the user also mailboxs, ftp accounts, domains and subdomains in database
    $query = "SELECT * FROM {$pro_mysql_domain_table} WHERE owner='{$adm_to_del}';";
    $result = mysql_query($query) or die("Cannot execute query \"{$query}\" !!!");
    $num_rows = mysql_num_rows($result);
    for ($i = 0; $i < $num_rows; $i++) {
        $row = mysql_fetch_array($result);
        //echo "Deleting ".$_REQUEST["delete_admin_user"]." / ".$row_virtual_admin["adm_pass"].$row["name"];
        deleteUserDomain($_REQUEST["delete_admin_user"], $row_virtual_admin["adm_pass"], $row["name"]);
    }
    if ($conf_demo_version == "no") {
        system("rm -rf {$the_admin_path}");
    }
    // Make all SSL vhosts the user registered available again
    $q = "UPDATE {$pro_mysql_ssl_ips_table} SET available='yes' WHERE adm_login='******';";
    $r = mysql_query($q) or die("Cannot execute query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    deleteMysqlUserAndDB($adm_to_del);
    // Delete all VPS of the user, and set all its IPs as available
    $q = "SELECT * FROM {$pro_mysql_vps_table} WHERE owner='{$adm_to_del}';";
    $r = mysql_query($q) or die("Cannot execute query \"{$q}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    for ($i = 0; $i < $n; $i++) {
        $vps = mysql_fetch_array($r);
        $q2 = "UPDATE {$pro_mysql_vps_ip_table} SET available='yes' WHERE vps_server_hostname='" . $vps["vps_server_hostname"] . "' AND vps_xen_name='" . $vps["vps_xen_name"] . "';";
        $r2 = mysql_query($q2) or die("Cannot execute query \"{$q2}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
        $q2 = "DELETE FROM {$pro_mysql_vps_stats_table} WHERE vps_server_hostname='" . $vps["vps_server_hostname"] . "' AND vps_xen_name='" . $vps["vps_xen_name"] . "';";
        $r2 = mysql_query($q2) or die("Cannot execute query \"{$q2}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
        // Unload (eg: destroy) the VPS directly
        remoteVPSAction($vps["vps_server_hostname"], $vps["vps_xen_name"], "destroy_vps");
        VPS_Server_Subscribe_To_Lists($vps["vps_server_hostname"]);
    }
    $q = "DELETE FROM {$pro_mysql_vps_table} WHERE owner='{$adm_to_del}';";
    $r = mysql_query($q) or die("Cannot execute query \"{$q}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    // Delete all dedicated servers of the admin
    $q = "DELETE FROM {$pro_mysql_dedicated_table} WHERE owner='{$adm_to_del}';";
    $r = mysql_query($q) or die("Cannot execute query \"{$q}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    // Delete all support tickets of the admin
    $q = "DELETE FROM {$pro_mysql_tik_queries_table} WHERE adm_login='******';";
    $r = mysql_query($q) or die("Cannot execute query \"{$q}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $adm_query = "DELETE FROM {$pro_mysql_admin_table} WHERE adm_login='******'";
    mysql_query($adm_query) or die("Cannot execute query \"{$adm_query}\" !!!");
    // Tell the cron job to activate the changes (in case there was some shared accounts. Todo: check if there is some...)
    $adm_query = "UPDATE {$pro_mysql_cronjob_table} SET qmail_newu='yes',restart_qmail='yes',reload_named='yes',\n\trestart_apache='yes',gen_vhosts='yes',gen_named='yes',gen_qmail='yes',gen_webalizer='yes',gen_backup='yes',gen_ssh='yes',gen_fetchmail='yes' WHERE 1;";
    mysql_query($adm_query);
    triggerDomainListUpdate();
}
Exemplo n.º 2
0
    if ($n != 1) {
        die("adm_login of pending domain not found!");
    }
    $a = mysql_fetch_array($r);
    addDomainToUser($a["adm_login"], $a["adm_pass"], $pending["domain_name"]);
    triggerDomainListUpdate();
    $q = "DELETE FROM {$pro_mysql_pending_queries_table} WHERE id='" . $_REQUEST["reqid"] . "';";
    $r = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
}
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "delete_waiting_domain_to_user") {
    $q = "DELETE FROM {$pro_mysql_pending_queries_table} WHERE id='" . $_REQUEST["reqid"] . "';";
    $r = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
}
///////////////////////////////////////////////////////////////
if (isset($_REQUEST["deluserdomain"]) && $_REQUEST["deluserdomain"] != "") {
    deleteUserDomain($adm_login, $adm_pass, $_REQUEST["deluserdomain"], true);
    // Tell the cron job to activate the changes
    $adm_query = "UPDATE {$pro_mysql_cronjob_table} SET qmail_newu='yes',restart_qmail='yes',reload_named='yes',\n\trestart_apache='yes',gen_vhosts='yes',gen_named='yes',gen_qmail='yes',gen_webalizer='yes',gen_backup='yes',gen_ssh='yes' WHERE 1;";
    mysql_query($adm_query);
    triggerDomainListUpdate();
}
////////////////////////////////////////////////
// Management of new users (eg virtual admins //
////////////////////////////////////////////////
if (isset($_REQUEST["updateuserinfo"]) && $_REQUEST["updateuserinfo"] == "Ok") {
    $adm_query = "UPDATE {$pro_mysql_admin_table} SET id_client='" . $_REQUEST["changed_id_client"] . "',\n\t\tadm_pass='******',path='" . $_REQUEST["changed_path"] . "',\n\t\tquota='" . $_REQUEST["adm_quota"] . "', bandwidth_per_month_mb='" . $_REQUEST["bandwidth_per_month"] . "',\n\t\texpire='" . $_REQUEST["expire"] . "',allow_add_domain='" . $_REQUEST["allow_add_domain"] . "',max_domain='" . $_REQUEST["max_domain"] . "',\n\t\tnbrdb='" . $_REQUEST["nbrdb"] . "',prod_id='" . $_REQUEST["heb_prod_id"] . "',\n\t\tresseller_flag='" . $_REQUEST["resseller_flag"] . "',\n\t\tssh_login_flag='" . $_REQUEST["ssh_login_flag"] . "',\n\t\tftp_login_flag='" . $_REQUEST["ftp_login_flag"] . "',\n\t\trestricted_ftp_path='" . $_REQUEST["restricted_ftp_path"] . "',\n\t\tallow_dns_and_mx_change='" . $_REQUEST["allow_dns_and_mx_change"] . "',\n\t\tallow_mailing_list_edit='" . $_REQUEST["allow_mailing_list_edit"] . "',\n\t\tallow_subdomain_edit='" . $_REQUEST["allow_subdomain_edit"] . "',\n\t\tpkg_install_flag='" . $_REQUEST["pkg_install_flag"] . "'\n\t\tWHERE adm_login='******';";
    mysql_query($adm_query) or die("Cannot execute query \"{$adm_query}\" line " . __LINE__ . " file " . __FILE__ . " " . mysql_error());
    // Tell the cron job to activate the changes (because the account might now be (not) expiring)
    $adm_query = "UPDATE {$pro_mysql_cronjob_table} SET gen_vhosts='yes',restart_apache='yes' WHERE 1;";
    mysql_query($adm_query);
}