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;
}
Exemple #3
0
function add_user_data($reseller_id)
{
    global $sql, $cfg;
    global $dmn_name, $hpid, $dmn_user_name;
    global $user_email, $customer_id, $first_name;
    global $last_name, $firm, $zip;
    global $city, $country, $street_one;
    global $street_two, $mail, $phone;
    global $fax, $inpass, $domain_ip;
    global $admin_login;
    // Let's get Desired Hosting Plan Data;
    //
    $err_msg = '_off_';
    reseller_limits_check($sql, $err_msg, $reseller_id, $hpid);
    if ($err_msg != '_off_') {
        set_page_message($err_msg);
        return;
    }
    if (isset($_SESSION["ch_hpprops"])) {
        $props = $_SESSION["ch_hpprops"];
        unset($_SESSION["ch_hpprops"]);
    } else {
        $query = "select props from hosting_plans where reseller_id = ? and id = ?";
        $res = exec_query($sql, $query, array($reseller_id, $hpid));
        $data = $res->FetchRow();
        $props = $data['props'];
    }
    list($php, $cgi, $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk) = explode(";", $props);
    $php = preg_replace("/\\_/", "", $php);
    $cgi = preg_replace("/\\_/", "", $cgi);
    $pure_user_pass = $inpass;
    $inpass = crypt_user_pass($inpass);
    //   $first_name = escape_user_data($first_name);
    //   $last_name = escape_user_data($last_name);
    //   $firm = escape_user_data($firm);
    //   $zip = escape_user_data($zip);
    //   $city = escape_user_data($city);
    //   $country = escape_user_data($country);
    //   $phone = escape_user_data($phone);
    //   $fax = escape_user_data($fax);
    //   $street_one = escape_user_data($street_one);
    //   $street_two = escape_user_data($street_two);
    //   $customer_id = escape_user_data($customer_id);
    if (!vhcs_domain_check($dmn_user_name)) {
        //set_page_message = tr("Wrong domain name syntax!");
        return;
    }
    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
                      )
                values
                      (
                        ?, ?, 'user', unix_timestamp(),
                        ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
                      )
VHCS_SQL_QUERY;
    $res = exec_query($sql, $query, array($dmn_user_name, $inpass, $reseller_id, $first_name, $last_name, $firm, $zip, $city, $country, $user_email, $phone, $fax, $street_one, $street_two, $customer_id));
    print $sql->ErrorMsg();
    $record_id = $sql->Insert_ID();
    $query = <<<VHCS_SQL_QUERY
            insert into domain (
                        domain_name, domain_admin_id,
                        domain_created_id, domain_created,
                        domain_mailacc_limit, domain_ftpacc_limit,
                        domain_traffic_limit, domain_sqld_limit,
                        domain_sqlu_limit, domain_status,
                        domain_subd_limit, domain_alias_limit,
                        domain_ip_id, domain_disk_limit,
                        domain_disk_usage, domain_php, domain_cgi
                       )
                values (
                        ?, ?,
                        ?, unix_timestamp(),
                        ?, ?,
                        ?, ?,
                        ?, 'toadd',
                        ?, ?,
                        ?, ?, '0',
                        ?, ?
                       )
VHCS_SQL_QUERY;
    $res = exec_query($sql, $query, array($dmn_name, $record_id, $reseller_id, $mail, $ftp, $traff, $sql_db, $sql_user, $sub, $als, $domain_ip, $disk, $php, $cgi));
    $dmn_id = $sql->Insert_ID();
    // vhcs 2.5 feature
    //add_domain_extras($dmn_id, $record_id, $sql);
    // lets send mail to user
    send_add_user_auto_msg($reseller_id, $dmn_user_name, $pure_user_pass, $user_email, $first_name, $last_name, tr('Domain account'));
    // send query to the vhcs2 daemon
    // add user into user_gui_props => domain looser needs language and skin too :-)
    $user_def_lang = $_SESSION['user_def_lang'];
    $user_theme_color = $_SESSION['user_theme_color'];
    $query = <<<SQL_QUERY
                insert into
                  user_gui_props
                      (user_id, lang, layout)
                  values
                      (?, ?, ?)
SQL_QUERY;
    $res = exec_query($sql, $query, array($record_id, $user_def_lang, $user_theme_color));
    send_request();
    $admin_login = $_SESSION['user_logged'];
    write_log("{$admin_login}: add user -> {$dmn_user_name} (for domain {$dmn_name})");
    write_log("{$admin_login}: add domain -> {$dmn_name}");
    au_update_reseller_props($reseller_id, $props);
    if (isset($_POST['add_alias']) && $_POST['add_alias'] === 'on') {
        //we have to add some aliases for this looser
        $_SESSION['dmn_id'] = $dmn_id;
        $_SESSION['dmn_ip'] = $domain_ip;
        header("Location: rau4.php?accout={$dmn_id}");
        die;
    } else {
        //we have not to add alias
        $_SESSION['rau3_added'] = "_yes_";
        header("Location: users.php");
        die;
    }
}
$_SESSION["ch_hpprops"] = $props;
reseller_limits_check($sql, $err_msg, $reseller_id, $hpid);
if ($err_msg != '_off_') {
    set_page_message($err_msg);
    unset($_SESSION['domain_ip']);
    header('Location: orders.php');
    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
                      (
function chk_dname($dname)
{
    if (vhcs_domain_check($dname) == 0) {
        return 1;
    }
    /* seems ok */
    return 0;
}