function check_data_iscorrect(&$tpl) { global $hp_name, $hp_php, $hp_cgi; global $hp_sub, $hp_als, $hp_mail; global $hp_ftp, $hp_sql_db, $hp_sql_user; global $hp_traff, $hp_disk; global $hpid; $ahp_error = "_off_"; $hp_name = $_POST['hp_name']; $hp_sub = $_POST['hp_sub']; $hp_als = $_POST['hp_als']; $hp_mail = $_POST['hp_mail']; $hp_ftp = $_POST['hp_ftp']; $hp_sql_db = $_POST['hp_sql_db']; $hp_sql_user = $_POST['hp_sql_user']; $hp_traff = $_POST['hp_traff']; $hp_disk = $_POST['hp_disk']; if (isset($_SESSION['hpid'])) { $hpid = $_SESSION['hpid']; } else { $ahp_error = tr('Undefined reference to data!'); } // put hosting plan id into session value $_SESSION['hpid'] = $hpid; // Get values from previes page and check him correction if (isset($_POST['php'])) { $hp_php = $_POST['php']; } if (isset($_POST['cgi'])) { $hp_cgi = $_POST['cgi']; } // if (!vhcs_name_check($hp_name, 200)) { // $ahp_error = tr('Incorrect template name range or syntax!'); // } else if (!is_numeric($_POST['hp_price'])) { $ahp_error = tr('Incorrect price. Example: 9.99'); } if (!is_numeric($_POST['hp_setupfee'])) { $ahp_error = tr('Incorrect setup fee. Example: 19.99'); } if (!vhcs_limit_check($hp_sub, 999)) { $ahp_error = tr('Incorrect subdomain range or syntax!'); } else { if (!vhcs_limit_check($hp_als, 999)) { $ahp_error = tr('Incorrect alias range or syntax!'); } else { if (!vhcs_limit_check($hp_mail, 999) || $hp_mail == -1) { $ahp_error = tr('Incorrect mail account range or syntax!'); } else { if (!vhcs_limit_check($hp_ftp, 999) || $hp_ftp == -1) { $ahp_error = tr('Incorrect FTP account range or syntax!'); } else { if (!vhcs_limit_check($hp_sql_user, 999)) { $ahp_error = tr('Incorrect SQL database range or syntax!'); } else { if (!vhcs_limit_check($hp_sql_db, 999)) { $ahp_error = tr('Incorrect SQL user range or syntax!'); } else { if (!vhcs_limit_check($hp_traff, 1024 * 1024) || $hp_traff == -1) { $ahp_error = tr('Incorrect traffic range or syntax!'); } else { if (!vhcs_limit_check($hp_disk, 1024 * 1024) || $hp_disk == -1) { $ahp_error = tr('Incorrect disk range or syntax!'); } } } } } } } } if ($ahp_error == '_off_') { $tpl->assign('MESSAGE', ''); return true; } else { set_page_message($ahp_error); return false; } return TRUE; }
function check_user_data() { global $reseller_ips, $sql; $username = $_POST['username']; $query = <<<SQL_QUERY select admin_id from admin where admin_name=? SQL_QUERY; $rs = exec_query($sql, $query, array($username)); if ($rs->RecordCount() != 0) { set_page_message(tr('This user name already exist!')); return false; } if (chk_username($_POST['username'])) { set_page_message(tr("Incorrect username range or syntax!")); return false; } if (chk_password($_POST['pass'])) { set_page_message(tr("Incorrect password range or syntax!")); return false; } if ($_POST['pass'] != $_POST['pass_rep']) { set_page_message(tr("Entered passwords does not match!")); return false; } if (chk_email($_POST['email'])) { set_page_message(tr("Incorrect email range or syntax!")); return false; } if (!vhcs_limit_check($_POST['nreseller_max_domain_cnt'], 999) || $_POST['nreseller_max_domain_cnt'] == -1) { set_page_message(tr("Incorrect max domain count or syntax!")); return false; } if (!vhcs_limit_check($_POST['nreseller_max_subdomain_cnt'], 999) || $_POST['nreseller_max_subdomain_cnt'] == -1) { set_page_message(tr("Incorrect max subdomain count or syntax!")); return false; } if (!vhcs_limit_check($_POST['nreseller_max_alias_cnt'], 999) || $_POST['nreseller_max_alias_cnt'] == -1) { set_page_message(tr('Incorrect max alias count or syntax!')); return false; } if (!vhcs_limit_check($_POST['nreseller_max_ftp_cnt'], 999) || $_POST['nreseller_max_ftp_cnt'] == -1) { set_page_message(tr('Incorrect max FTP count or syntax!')); return false; } if (!vhcs_limit_check($_POST['nreseller_max_mail_cnt'], 999) || $_POST['nreseller_max_mail_cnt'] == -1) { set_page_message(tr('Incorrect max mail count or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_sql_db_cnt'], 999) || $_POST['nreseller_max_sql_db_cnt'] == -1) { set_page_message(tr('Incorrect max SQL databases count or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_sql_user_cnt'], 999) || $_POST['nreseller_max_sql_user_cnt'] == -1) { set_page_message(tr('Incorrect max SQL users count or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_traffic'], 999999) || $_POST['nreseller_max_traffic'] == -1) { set_page_message(tr('Incorrect max traffic amount or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_disk'], 999999) || $_POST['nreseller_max_disk'] == -1) { set_page_message(tr('Incorrect max disk amount or syntax!')); return false; } else { if ($reseller_ips == '') { set_page_message(tr('You must assign at least one IP number for a reseller!')); return false; } } } } } } return true; }
function check_data_correction(&$tpl) { global $hp_name, $description, $hp_php, $hp_cgi; global $hp_sub, $hp_als, $hp_mail; global $hp_ftp, $hp_sql_db, $hp_sql_user; global $hp_traff, $hp_disk; global $price, $setup_fee, $value, $payment, $status; $ahp_error = "_off_"; $hp_name = htmlspecialchars(stripslashes($_POST['hp_name']), ENT_QUOTES, "UTF-8"); $hp_sub = $_POST['hp_sub']; $hp_als = $_POST['hp_als']; $hp_mail = $_POST['hp_mail']; $hp_ftp = $_POST['hp_ftp']; $hp_sql_db = $_POST['hp_sql_db']; $hp_sql_user = $_POST['hp_sql_user']; $hp_traff = $_POST['hp_traff']; $hp_disk = $_POST['hp_disk']; $description = htmlspecialchars(stripslashes($_POST['hp_description']), ENT_QUOTES, "UTF-8"); if ($_POST['hp_price'] == '') { $price = 0; } else { $price = $_POST['hp_price']; } if ($_POST['hp_setupfee'] == '') { $setup_fee = 0; } else { $setup_fee = $_POST['hp_setupfee']; } $value = $_POST['hp_value']; $payment = $_POST['hp_payment']; $status = $_POST['status']; if (isset($_POST['php'])) { $hp_php = $_POST['php']; } if (isset($_POST['cgi'])) { $hp_cgi = $_POST['cgi']; } if ($hp_name == '') { $ahp_error = tr('Incorrect template name range or syntax!'); } if ($description == '') { $ahp_error = tr('Incorrect template description range or syntax!'); } if (!is_numeric($price)) { $ahp_error = tr('Incorrect price range or syntax!'); } if (!is_numeric($setup_fee)) { $ahp_error = tr('Incorrect setup fee range or syntax!'); } if (!vhcs_limit_check($hp_sub, 999)) { $ahp_error = tr('Incorrect subdomain range or syntax!'); } else { if (!vhcs_limit_check($hp_als, 999)) { $ahp_error = tr('Incorrect alias range or syntax!'); } else { if (!vhcs_limit_check($hp_mail, 999)) { $ahp_error = tr('Incorrect mail account range or syntax!'); } else { if (!vhcs_limit_check($hp_ftp, 999) || $hp_ftp == -1) { $ahp_error = tr('Incorrect FTP account range or syntax!'); } else { if (!vhcs_limit_check($hp_sql_user, 999)) { $ahp_error = tr('Incorrect SQL database range or syntax!'); } else { if (!vhcs_limit_check($hp_sql_db, 999)) { $ahp_error = tr('Incorrect SQL user range or syntax!'); } else { if (!vhcs_limit_check($hp_traff, 1024 * 1024) || $hp_traff == -1) { $ahp_error = tr('Incorrect traffic range or syntax!'); } else { if (!vhcs_limit_check($hp_disk, 1024 * 1024) || $hp_disk == -1) { $ahp_error = tr('Incorrect disk range or syntax!'); } } } } } } } } if ($ahp_error == '_off_') { $tpl->assign('MESSAGE', ''); return true; } else { set_page_message($ahp_error); //$tpl -> assign('MESSAGE', $ahp_error); return false; } return TRUE; }
function check_user_data() { global $reseller_ips, $sql; if ($_POST['pass'] != '' || $_POST['pass_rep'] != '') { if (chk_password($_POST['pass'])) { set_page_message(tr("Incorrect password range or syntax!")); return false; } if ($_POST['pass'] != $_POST['pass_rep']) { set_page_message(tr("Entered passwords does not match!")); return false; } } if (chk_email($_POST['email'])) { set_page_message(tr("Incorrect email range or syntax!")); return false; } if (!vhcs_limit_check($_POST['nreseller_max_domain_cnt'], 999) || $_POST['nreseller_max_domain_cnt'] == -1) { set_page_message(tr("Incorrect max domain count or syntax!")); return false; } if (!vhcs_limit_check($_POST['nreseller_max_subdomain_cnt'], 999) || $_POST['nreseller_max_subdomain_cnt'] == -1) { set_page_message(tr("Incorrect max subdomain count or syntax!")); return false; } if (!vhcs_limit_check($_POST['nreseller_max_alias_cnt'], 999) || $_POST['nreseller_max_alias_cnt'] == -1) { set_page_message(tr('Incorrect max alias count or syntax!')); return false; } if (!vhcs_limit_check($_POST['nreseller_max_ftp_cnt'], 999) || $_POST['nreseller_max_ftp_cnt'] == -1) { set_page_message(tr('Incorrect max FTP count or syntax!')); return false; } if (!vhcs_limit_check($_POST['nreseller_max_mail_cnt'], 999) || $_POST['nreseller_max_mail_cnt'] == -1) { set_page_message(tr('Incorrect max mail count or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_sql_db_cnt'], 999) || $_POST['nreseller_max_sql_db_cnt'] == -1) { set_page_message(tr('Incorrect max SQL databases count or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_sql_user_cnt'], 999) || $_POST['nreseller_max_sql_user_cnt'] == -1) { set_page_message(tr('Incorrect max SQL users count or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_traffic'], 999999) || $_POST['nreseller_max_traffic'] == -1) { set_page_message(tr('Incorrect max traffic amount or syntax!')); return false; } else { if (!vhcs_limit_check($_POST['nreseller_max_disk'], 999999) || $_POST['nreseller_max_disk'] == -1) { set_page_message(tr('Incorrect max disk amount or syntax!')); return false; } else { if ($reseller_ips == '') { set_page_message(tr('You must assign at least one IP number for a reseller!')); return false; } } } } } } global $edit_id, $rip_lst; return check_reseller_data($edit_id, $rip_lst, $reseller_ips); }
if (!vhcs_limit_check($mail, 999)) { $ed_error = tr('Incorrect mail account range or syntax!'); } else { if (!vhcs_limit_check($ftp, 999) || $ftp == -1) { $ed_error = tr('Incorrect FTP account range or syntax!'); } else { if (!vhcs_limit_check($sql_db, 999)) { $ed_error = tr('Incorrect SQL user range or syntax!'); } else { if (!vhcs_limit_check($sql_user, 999)) { $ed_error = tr('Incorrect SQL database range or syntax!'); } else { if (!vhcs_limit_check($traff, 1024 * 1024) || $traff == -1) { $ed_error = tr('Incorrect traffic range or syntax!'); } else { if (!vhcs_limit_check($disk, 1024 * 1024) || $disk == -1) { $ed_error = tr('Incorrect disk range or syntax!'); } } } } } } } } list($usub_current, $usub_max, $uals_current, $uals_max, $umail_current, $umail_max, $uftp_current, $uftp_max, $usql_db_current, $usql_db_max, $usql_user_current, $usql_user_max, $utraff_max, $udisk_max) = generate_user_props($dmn_id); list($rdmn_current, $rdmn_max, $rsub_current, $rsub_max, $rals_current, $rals_max, $rmail_current, $rmail_max, $rftp_current, $rftp_max, $rsql_db_current, $rsql_db_max, $rsql_user_current, $rsql_user_max, $rtraff_current, $rtraff_max, $rdisk_current, $rdisk_max) = get_reseller_default_props($sql, $reseller_id); //generate_reseller_props($reseller_id); list($a, $b, $c, $d, $e, $f, $utraff_current, $udisk_current, $i, $h) = generate_user_traffic($dmn_id); if ($ed_error == '_off_') { calculate_user_dvals($sub, $usub_current, $usub_max, $rsub_current, $rsub_max, $ed_error, tr('Subdomain'));
function check_user_data(&$tpl) { global $hp_name, $hp_php, $hp_cgi; global $hp_sub, $hp_als, $hp_mail; global $hp_ftp, $hp_sql_db, $hp_sql_user; global $hp_traff, $hp_disk, $hp_dmn; $ehp_error = '_off_'; // Gete data for fields from previus page if (isset($_POST['template'])) { $hp_name = $_POST['template']; } if (isset($_POST['nreseller_max_domain_cnt'])) { $hp_dmn = $_POST['nreseller_max_domain_cnt']; } if (isset($_POST['nreseller_max_subdomain_cnt'])) { $hp_sub = $_POST['nreseller_max_subdomain_cnt']; } if (isset($_POST['nreseller_max_alias_cnt'])) { $hp_als = $_POST['nreseller_max_alias_cnt']; } if (isset($_POST['nreseller_max_mail_cnt'])) { $hp_mail = $_POST['nreseller_max_mail_cnt']; } if (isset($_POST['nreseller_max_ftp_cnt'])) { $hp_ftp = $_POST['nreseller_max_ftp_cnt']; } if (isset($_POST['nreseller_max_sql_db_cnt'])) { $hp_sql_db = $_POST['nreseller_max_sql_db_cnt']; } if (isset($_POST['nreseller_max_sql_user_cnt'])) { $hp_sql_user = $_POST['nreseller_max_sql_user_cnt']; } if (isset($_POST['nreseller_max_traffic'])) { $hp_traff = $_POST['nreseller_max_traffic']; } if (isset($_POST['nreseller_max_disk'])) { $hp_disk = $_POST['nreseller_max_disk']; } //if(isset($_POST[''])) // $hp_dmn = $_POST['']; if (isset($_POST['php'])) { $hp_php = $_POST['php']; } if (isset($_POST['cgi'])) { $hp_cgi = $_POST['cgi']; } // Begin checking... /* if (!vhcs_name_check($hp_name, 200)) { $ehp_error = tr('Incorrect template name range or syntax!'); } if(!check_hosting_plan_name($_SESSION{'user_id'})) { $ehp_error = tr('Hosting plan with entered name already exists!'); } else*/ if (!vhcs_limit_check($hp_sub, 999)) { $ehp_error = tr('Incorrect subdomain range or syntax!'); } else { if (!vhcs_limit_check($hp_als, 999)) { $ehp_error = tr('Incorrect alias range or syntax!'); } else { if (!vhcs_limit_check($hp_mail, 999)) { $ehp_error = tr('Incorrect mail account range or syntax!'); } else { if (!vhcs_limit_check($hp_ftp, 999)) { $ehp_error = tr('Incorrect FTP account range or syntax!'); } else { if (!vhcs_limit_check($hp_sql_user, 999)) { $ehp_error = tr('Incorrect SQL database range or syntax!'); } else { if (!vhcs_limit_check($hp_sql_db, 999)) { $ehp_error = tr('Incorrect SQL user range or syntax!'); } else { if (!vhcs_limit_check($hp_traff, 1024 * 1024)) { $ehp_error = tr('Incorrect traffic range or syntax!'); } else { if (!vhcs_limit_check($hp_disk, 1024 * 1024)) { $ehp_error = tr('Incorrect disk range or syntax!'); } } } } } } } } if ($ehp_error == '_off_') { $tpl->assign('MESSAGE', ''); // send data throught session return true; } else { $tpl->assign('MESSAGE', $ehp_error); return false; } return true; }
function check_user_data(&$tpl, &$sql, $reseller_id, $user_id) { global $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk, $sql, $domain_ip, $domain_php, $domain_cgi; $sub = $_POST['dom_sub']; $als = $_POST['dom_alias']; $mail = $_POST['dom_mail_acCount']; $ftp = $_POST['dom_ftp_acCounts']; $sql_db = $_POST['dom_sqldb']; $sql_user = $_POST['dom_sql_users']; $traff = $_POST['dom_traffic']; $disk = $_POST['dom_disk']; //$domain_ip = $_POST['domain_ip']; $domain_php = $_POST['domain_php']; $domain_cgi = $_POST['domain_cgi']; $ed_error = '_off_'; if (!vhcs_limit_check($sub, 999)) { $ed_error = tr('Incorrect subdomain range or syntax!'); } else { if (!vhcs_limit_check($als, 999)) { $ed_error = tr('Incorrect alias range or syntax!'); } else { if (!vhcs_limit_check($mail, 999)) { $ed_error = tr('Incorrect mail account range or syntax!'); } else { if (!vhcs_limit_check($ftp, 999) || $ftp == -1) { $ed_error = tr('Incorrect FTP account range or syntax!'); } else { if (!vhcs_limit_check($sql_db, 999)) { $ed_error = tr('Incorrect SQL user range or syntax!'); } else { if (!vhcs_limit_check($sql_user, 999)) { $ed_error = tr('Incorrect SQL database range or syntax!'); } else { if (!vhcs_limit_check($traff, 1024 * 1024) || $traff == -1) { $ed_error = tr('Incorrect traffic range or syntax!'); } else { if (!vhcs_limit_check($disk, 1024 * 1024) || $disk == -1) { $ed_error = tr('Incorrect disk range or syntax!'); } } } } } } } } //$user_props = generate_user_props($user_id); //$reseller_props = generate_reseller_props($reseller_id); list($usub_current, $usub_max, $uals_current, $uals_max, $umail_current, $umail_max, $uftp_current, $uftp_max, $usql_db_current, $usql_db_max, $usql_user_current, $usql_user_max, $utraff_max, $udisk_max) = generate_user_props($user_id); list($rdmn_current, $rdmn_max, $rsub_current, $rsub_max, $rals_current, $rals_max, $rmail_current, $rmail_max, $rftp_current, $rftp_max, $rsql_db_current, $rsql_db_max, $rsql_user_current, $rsql_user_max, $rtraff_current, $rtraff_max, $rdisk_current, $rdisk_max) = get_reseller_default_props($sql, $reseller_id); //generate_reseller_props($reseller_id); list($a, $b, $c, $d, $e, $f, $utraff_current, $udisk_current, $i, $h) = generate_user_traffic($user_id); if ($ed_error == '_off_') { calculate_user_dvals($sub, $usub_current, $usub_max, $rsub_current, $rsub_max, $ed_error, tr('Subdomain')); } if ($ed_error == '_off_') { calculate_user_dvals($als, $uals_current, $uals_max, $rals_current, $rals_max, $ed_error, tr('Alias')); } if ($ed_error == '_off_') { calculate_user_vals($mail, $umail_current, $umail_max, $rmail_current, $rmail_max, $ed_error, tr('Mail')); } if ($ed_error == '_off_') { calculate_user_vals($ftp, $uftp_current, $uftp_max, $rftp_current, $rftp_max, $ed_error, tr('FTP')); } if ($ed_error == '_off_') { calculate_user_dvals($sql_db, $usql_db_current, $usql_db_max, $rsql_db_current, $rsql_db_max, $ed_error, tr('SQL Database')); } if ($ed_error == '_off_') { $query = <<<SQL_QUERY \t\t\tSELECT \t\t\t\tCOUNT(su.sqlu_id) as cnt \t\t\tFROM \t\t\t\tsql_user as su, sql_database as sd \t\t\tWHERE \t\t\t\tsu.sqld_id = sd.sqld_id \t\t\tAND \t\t\t\tsd.domain_id = ? SQL_QUERY; $rs = exec_query($sql, $query, array($_SESSION['user_id'])); calculate_user_dvals($sql_user, $rs->fields['cnt'], $usql_user_max, $rsql_user_current, $rsql_user_max, $ed_error, tr('SQL User')); } if ($ed_error == '_off_') { calculate_user_vals($traff, $utraff_current / 1024 / 1024, $utraff_max, $rtraff_current, $rtraff_max, $ed_error, tr('Traffic')); } if ($ed_error == '_off_') { calculate_user_vals($disk, $udisk_current / 1024 / 1024, $udisk_max, $rdisk_current, $rdisk_max, $ed_error, tr('Disk')); } if ($ed_error == '_off_') { $user_props = "{$usub_current};{$usub_max};"; $user_props .= "{$uals_current};{$uals_max};"; $user_props .= "{$umail_current};{$umail_max};"; $user_props .= "{$uftp_current};{$uftp_max};"; $user_props .= "{$usql_db_current};{$usql_db_max};"; $user_props .= "{$usql_user_current};{$usql_user_max};"; $user_props .= "{$utraff_max};"; $user_props .= "{$udisk_max};"; //$user_props .= "$domain_ip;"; $user_props .= "{$domain_php};"; $user_props .= "{$domain_cgi}"; update_user_props($user_id, $user_props); $reseller_props = "{$rdmn_current};{$rdmn_max};"; $reseller_props .= "{$rsub_current};{$rsub_max};"; $reseller_props .= "{$rals_current};{$rals_max};"; $reseller_props .= "{$rmail_current};{$rmail_max};"; $reseller_props .= "{$rftp_current};{$rftp_max};"; $reseller_props .= "{$rsql_db_current};{$rsql_db_max};"; $reseller_props .= "{$rsql_user_current};{$rsql_user_max};"; $reseller_props .= "{$rtraff_current};{$rtraff_max};"; $reseller_props .= "{$rdisk_current};{$rdisk_max}"; update_reseller_props($reseller_id, $reseller_props); // update the sql quotas too $query = "select domain_name from domain where domain_id=?"; $rs = exec_query($sql, $query, array($user_id)); $temp_dmn_name = $rs->fields['domain_name']; $query = "SELECT count(name) as cnt from quotalimits where name=?"; $rs = exec_query($sql, $query, array($temp_dmn_name)); if ($rs->fields['cnt'] > 0) { // we need to update it if ($disk == 0) { $dlim = 0; } else { $dlim = $disk * 1024 * 1024; } $query = "UPDATE quotalimits SET bytes_in_avail=? WHERE name=?"; $rs = exec_query($sql, $query, array($dlim, $temp_dmn_name)); } set_page_message(tr('Domain properties updated successfully!')); return true; } else { $tpl->assign('MESSAGE', $ed_error); $tpl->parse('PAGE_MESSAGE', 'page_message'); return false; } }