Exemple #1
0
function check_user_data(&$tpl)
{
    global $dmn_name;
    // Domain name
    global $dmn_chp;
    // choosed hosting plan;
    global $dmn_pt;
    global $cfg;
    // personal template
    $even_txt = "_off_";
    if (isset($_POST['dmn_name'])) {
        $dmn_name = strtolower($_POST['dmn_name']);
    }
    $dmn_name = get_punny($dmn_name);
    if (isset($_POST['dmn_tpl'])) {
        $dmn_chp = $_POST['dmn_tpl'];
    }
    if (isset($_POST['chtpl'])) {
        $dmn_pt = $_POST['chtpl'];
    }
    if (!vhcs_domain_check($dmn_name)) {
        $even_txt = tr('Wrong domain name syntax!');
    } else {
        if (vhcs_domain_exists($dmn_name, $_SESSION['user_id'])) {
            $even_txt = tr('Domain with that name already exists on the system!');
        }
    }
    // we have plans only for admins
    if (isset($cfg['HOSTING_PLANS_LEVEL']) && $cfg['HOSTING_PLANS_LEVEL'] === 'admin') {
        $dmn_pt = '_no_';
    }
    if ($even_txt != '_off_') {
        // There are wrong input data
        set_page_message($even_txt);
        return false;
    } else {
        if ($dmn_pt == '_yes_' || !isset($_POST['dmn_tpl'])) {
            // send through the session the data
            $_SESSION['dmn_name'] = $dmn_name;
            $_SESSION['dmn_tpl'] = $dmn_chp;
            $_SESSION['chtpl'] = $dmn_pt;
            $_SESSION['step_one'] = "_yes_";
            Header("Location: rau2.php");
            die;
        } else {
            // send through the session the data
            $_SESSION['dmn_name'] = $dmn_name;
            $_SESSION['dmn_tpl'] = $dmn_chp;
            $_SESSION['chtpl'] = $dmn_pt;
            $_SESSION['step_one'] = "_yes_";
            Header("Location: rau3.php");
            die;
        }
    }
}
Exemple #2
0
function addon_domain(&$tpl, $dmn_name)
{
    $dmn_name = strtolower($dmn_name);
    $dmn_name = get_punny($dmn_name);
    if (!vhcs_domain_check($dmn_name)) {
        set_page_message(tr('Wrong domain name syntax!'));
        return;
    } else {
        if (vhcs_domain_exists($dmn_name, 0)) {
            set_page_message(tr('Domain with that name already exists on the system!'));
            return;
        }
    }
    $_SESSION['domainname'] = $dmn_name;
    header("Location: address.php");
    die;
}
function add_domain_alias(&$sql, &$err_al)
{
    global $cr_user_id, $alias_name, $domain_ip, $forward, $mount_point;
    $cr_user_id = $domain_id = get_user_domain_id($sql, $_SESSION['user_id']);
    $alias_name = strtolower($_POST['ndomain_name']);
    $mount_point = strtolower($_POST['ndomain_mpoint']);
    $forward = $_POST['forward'];
    $query = <<<SQL_QUERY
        select
            domain_ip_id
        from
            domain
        where
            domain_id = ?
SQL_QUERY;
    $rs = exec_query($sql, $query, array($cr_user_id));
    $domain_ip = $rs->fields['domain_ip_id'];
    $alias_name = get_punny($alias_name);
    //$mount_point = "/".$mount_point;
    // Fisrt check is the data correct
    if (chk_dname($alias_name) > 0) {
        $err_al = tr("Incorrect domain name syntax");
    } else {
        if (vhcs_domain_exists($alias_name, 0)) {
            $err_al = tr('Domain with that name already exists on the system!');
        } else {
            if (chk_mountp($mount_point) > 0) {
                $err_al = tr("Incorrect mount point syntax");
            } else {
                if ($forward != 'no') {
                    if (chk_url($forward) > 0) {
                        $err_al = tr("Incorrect forward syntax");
                    }
                } else {
                    $query = "select domain_id from domain_aliasses where alias_name=?";
                    $res = exec_query($sql, $query, array($alias_name));
                    $query = "select domain_id from domain where domain_name=?";
                    $res2 = exec_query($sql, $query, array($alias_name));
                    if ($res->RowCount() > 0 or $res2->RowCount() > 0) {
                        // we already have domain with this name
                        $err_al = tr("Domain with this name already exist");
                    }
                    // all seems ok - add it
                    $query = "select count(alias_id) as cnt from domain_aliasses where domain_id=? and alias_mount=?";
                    $mres = exec_query($sql, $query, array($cr_user_id, $mount_point));
                    $mdata = $mres->FetchRow();
                    $query = "select count(subdomain_id) as cnt from subdomain where domain_id=? and subdomain_mount=?";
                    $subdomres = exec_query($sql, $query, array($cr_user_id, $mount_point));
                    $subdomdata = $subdomres->FetchRow();
                    if ($mdata['cnt'] > 0 || $subdomdata['cnt'] > 0) {
                        // whe have alias with same mount point !!! ERROR
                        $err_al = tr("There are alias with same mount point");
                    }
                }
            }
        }
    }
    if ('_off_' !== $err_al) {
        return;
    }
    // Begin add new alias domain
    $alias_name = htmlspecialchars($alias_name, ENT_QUOTES, "UTF-8");
    check_for_lock_file();
    global $cfg;
    $status = $cfg['ITEM_ADD_STATUS'];
    $query = "insert into domain_aliasses(domain_id, alias_name, alias_mount, alias_status, alias_ip_id, url_forward) values (?, ?, ?, ?, ?, ?)";
    exec_query($sql, $query, array($cr_user_id, $alias_name, $mount_point, $status, $domain_ip, $forward));
    send_request();
    $admin_login = $_SESSION['user_logged'];
    write_log("{$admin_login}: add domain alias -> {$alias_name}");
    set_page_message(tr('Alias scheduled for addition!'));
    header("Location: manage_domains.php");
    die;
}
Exemple #4
0
function add_domain_alias(&$sql, &$err_al)
{
    global $cr_user_id, $alias_name, $domain_ip, $forward, $mount_point, $tpl;
    $cr_user_id = $_SESSION['dmn_id'];
    $alias_name = strtolower($_POST['ndomain_name']);
    $domain_ip = $_SESSION['dmn_ip'];
    $mount_point = strtolower($_POST['ndomain_mpoint']);
    $forward = $_POST['forward'];
    $alias_name = get_punny($alias_name);
    // Fisrt check is the data correct
    if (chk_dname($alias_name) > 0) {
        $err_al = tr("Incorrect domain name syntax");
    } else {
        if (vhcs_domain_exists($alias_name, $_SESSION['user_id'])) {
            $err_al = tr('Domain with that name already exists on the system!');
        } else {
            if (chk_mountp($mount_point) > 0) {
                $err_al = tr("Incorrect mount point syntax");
            } else {
                if ($forward != 'no') {
                    if (chk_url($forward) > 0) {
                        $err_al = tr("Incorrect forward syntax");
                    }
                } else {
                    $res = exec_query($sql, "select domain_id from domain_aliasses where alias_name=?", array($alias_name));
                    $res2 = exec_query($sql, "select domain_id from domain where domain_name =?", array($alias_name));
                    if ($res->RowCount() > 0 or $res2->RowCount() > 0) {
                        // we already have domain with this name
                        $err_al = tr("Domain with this name already exist");
                    }
                    // all seems ok - add it
                    $mres = exec_query($sql, "select count(alias_id) as cnt from domain_aliasses where domain_id=? and alias_mount=?", array($cr_user_id, $mount_point));
                    $mdata = $mres->FetchRow();
                    $subdomres = exec_query($sql, "select count(subdomain_id) as cnt from subdomain where domain_id=? and subdomain_mount=?", array($cr_user_id, $mount_point));
                    $subdomdata = $subdomres->FetchRow();
                    if ($mdata['cnt'] > 0 || $subdomdata['cnt'] > 0) {
                        // whe have alias with same mount point !!! ERROR
                        $err_al = tr("There are alias with same mount point");
                    }
                }
            }
        }
    }
    if ('_off_' !== $err_al) {
        set_page_message($err_al);
        return;
    }
    // Begin add new alias domain
    check_for_lock_file();
    global $cfg;
    $status = $cfg['ITEM_ADD_STATUS'];
    exec_query($sql, "insert into domain_aliasses(domain_id, alias_name, alias_mount, alias_status, alias_ip_id, url_forward) values (?, ?, ?, ?, ?, ?)", array($cr_user_id, $alias_name, $mount_point, $status, $domain_ip, $forward));
    send_request();
    $admin_login = $_SESSION['user_logged'];
    write_log("{$admin_login}: add domain alias -> {$alias_name}");
    set_page_message(tr('Domain alias added!'));
}
    die;
}
unset($_SESSION["ch_hpprops"]);
list($php, $cgi, $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk) = explode(";", $props);
$php = preg_replace("/\\_/", "", $php);
$cgi = preg_replace("/\\_/", "", $cgi);
$timestamp = time();
$pure_user_pass = substr($timestamp, 0, 6);
$inpass = crypt_user_pass($pure_user_pass);
if (!vhcs_domain_check($dmn_user_name)) {
    set_page_message(tr('Wrong domain name syntax!'));
    unset($_SESSION['domain_ip']);
    header('Location: orders.php');
    die;
}
if (vhcs_domain_exists($dmn_name, $_SESSION['user_id'])) {
    set_page_message(tr('Domain with that name already exists on the system!'));
    unset($_SESSION['domain_ip']);
    header('Location: orders.php');
    die;
}
check_for_lock_file();
$query = <<<VHCS_SQL_QUERY
            insert into admin
                      (
                        admin_name, admin_pass, admin_type, domain_created,
                        created_by, fname, lname,
                        firm, zip, city,
                        country, email, phone,
                        fax, street1, street2, customer_id
                      )