Example #1
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;
    }
}
Example #2
0
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);
set_page_message(tr('User added!'));
$query = <<<SQL_QUERY
            update
                orders
            set
                status=?
            where
                id=?
SQL_QUERY;
exec_query($sql, $query, array('added', $order_id));
unset($_SESSION['domain_ip']);
header("Location: users.php");
die;