Changeset 1005

Show
Ignore:
Timestamp:
02/17/08 00:17:31 (6 months ago)
Author:
rats
Message:

A lot of inconsistency adding a user while reseller values are eceeded

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG

    r1004 r1005  
    11ispCP ω 1.0.0 Changelog 
    22~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     3 
     42008-02-16 Benedikt Heintel 
     5        - GUI: 
     6                * Fixed: A lot of inconsistency adding a user while reseller values are eceeded 
     7 
     82008-02-16 Jochen Manz 
     9        - DISTS: 
     10                * Fixed #772: Gentoo init.d scripts broken with changes to make them "LSB compliant" 
    311 
    4122008-02-16 Christian Hernmarck 
     
    1321                * Fixed #894: Domain Alias as Forward - including directory information 
    1422                * Fixed #1023: master domain can be added as user 
     23                * Fixed #1045: Alias via mod_alias (Redirect) -> FIX 
    1524 
    16252008-02-13 Benedikt Heintel 
  • trunk/configs/dists/gentoo/init.d/ispcp_daemon

    r918 r1005  
    1 #! /bin/sh 
    2  
     1#!/sbin/runscript 
     2
    33# ispCP ω (OMEGA) a Virtual Hosting Control System 
    4 # Copyright (c) 2007 by ispCP 
     4# Copyright (c) 2008 by ispCP 
    55# http://www.isp-control.net 
    66# 
     
    2828#    http://www.isp-control.net 
    2929# 
    30 ### BEGIN INIT INFO 
    31 # Provides:             ispcp_daemon 
    32 # Required-Start:       $network $local_fs $remote_fs 
    33 # Required-Stop: 
    34 # Should-Stop:          $local_fs 
    35 # Default-Start:        2 3 4 5 
    36 # Default-Stop:         0 1 6 
    37 # Short-Description:    ispCP GUI-Backend communication Daemon 
    38 ### END INIT INFO 
    39 # Note: do not modify any of these vars here, use /etc/default/$NAME instead 
    4030 
    41 PATH=/sbin:/bin:/usr/sbin:/usr/bin 
    42 NAME=ispcp_daemon 
     31NAME="ispCP Deamon" 
    4332DAEMON=/var/www/ispcp/daemon/ispcp_daemon 
    4433PID=/var/run/ispcp-daemon.pid 
    4534DESC="ispCP GUI-Backend communication Daemon" 
    4635 
     36opts="" 
    4737 
    48 test -f $DAEMON || exit 0 
     38depend() { 
     39    need net 
     40    after apache mysql 
     41    use logger 
     42
    4943 
    50 set -e 
     44start() { 
     45    ebegin "Starting $NAME:" 
     46    start-stop-daemon --start --exec $DAEMON \ 
     47                --pidfile $PID 
     48    eend $? 
     49
    5150 
    52 case "$1" in 
    53   start) 
    54         echo -n "Starting $DESC: " 
    55         start-stop-daemon --start --verbose --exec $DAEMON -- -p $PID 
    56         echo "$NAME." 
    57         ;; 
    58   stop) 
    59         echo -n "Stopping $DESC: " 
    60         start-stop-daemon --stop --verbose --pidfile $PID --exec $DAEMON --retry 5 
    61         rm $PID 
    62         echo "$NAME." 
    63         ;; 
    64   restart|force-reload) 
    65         echo "Restarting $DESC: " 
    66         start-stop-daemon --stop --verbose --pidfile $PID --exec $DAEMON --retry 5 
    67         rm $PID 
    68         start-stop-daemon --start --verbose --exec $DAEMON -- -p $PID 
    69         ;; 
    70   status) 
    71     set +e 
    72     if [ -s $PID ]; then 
    73         RPID=`cat $PID` 
    74         kill -0 $RPID 2> /dev/null 
    75         if [ "$?" = 0 ] ; then 
    76             echo "$NAME is started" 
    77             exit 0 
    78         fi 
    79     fi 
    80     echo "$NAME is stopped" 
    81     exit 1 
    82         ;; 
    83   *) 
    84         N=/etc/init.d/$NAME 
    85         echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 
    86         exit 1 
    87         ;; 
    88 esac 
    8951 
    90 exit 0 
     52stop() { 
     53    ebegin "Stopping $NAME:" 
     54    start-stop-daemon --stop --exec $DAEMON \ 
     55                --pidfile $PID 
     56    eend $? 
     57
  • trunk/docs/Debian/INSTALL

    r999 r1005  
    9292        (when you get to the rootkithunter screen, select two time 'yes') 
    9393 
    94         Now install needed Perl modules: 
    95  
    96         # cpan 
    97         cpan> install FindBin 
    98         cpan> install Net::LibIDN 
    99         cpan> quit 
    100  
    101944. (optional) Check the ispcp.conf and adapt it to your requirements. 
    10295   An overview over the variables you can find in the FAQ on 
  • trunk/gui/include/layout-functions.php

    r830 r1005  
    8484function set_page_message($message) { 
    8585        if (isset($_SESSION['user_page_message'])) 
    86                 $_SESSION['user_page_message'] .= "<br><br>$message<br><br>"; 
     86                $_SESSION['user_page_message'] .= "<br />$message\n"; 
    8787        else 
    8888                $_SESSION['user_page_message'] = $message; 
  • trunk/gui/include/reseller-functions.php

    r951 r1005  
    44 * 
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    6  * @copyright   2006-2007 by ispCP | http://isp-control.net 
     6 * @copyright   2006-2008 by ispCP | http://isp-control.net 
     7 * @version     SVN: $ID$ 
    78 * @link                http://isp-control.net 
    8  * @author              ispCP Team (2007) 
     9 * @author              ispCP Team 
    910 * 
    1011 * @license 
     
    535536                ); 
    536537} // End of get_user_props(); 
    537 function rsl_full_domain_check ($data) 
    538 
     538 
     539function rsl_full_domain_check ($data)
    539540        $data .= '.'; 
    540541        $match = array(); 
     
    567568        return 1; 
    568569} // End of  full_domain_check() 
     570 
    569571// Generate ip list 
    570 function generate_ip_list(&$tpl, &$reseller_id) 
    571 
     572function generate_ip_list(&$tpl, &$reseller_id) { 
    572573        global $sql; 
    573574        global $domain_ip; 
     
    616617        } // End loop 
    617618} // End of generate_ip_list() 
     619 
    618620// Check validity of input data 
    619 function check_ruser_data (&$tpl, $NoPass) 
    620 
     621function check_ruser_data (&$tpl, $NoPass) { 
    621622        global $dmn_name, $hpid , $dmn_user_name; 
    622623        global $user_email, $customer_id, $first_name; 
     
    728729        return false; 
    729730} //End of check_ruser_data() 
     731 
    730732// Translate domain status 
    731733function translate_dmn_status ($status) { 
     
    752754        } 
    753755} // End of translate_dmn_status() 
     756 
    754757// Check if the domain already exist 
    755 function ispcp_domain_exists ($domain_name, $reseller_id) 
    756 
     758function ispcp_domain_exists ($domain_name, $reseller_id) { 
    757759        global $sql; 
    758760        // query to check if the domain name exist in the table for domains/accounts 
     
    864866        } 
    865867} // End of ispcp_domain_exists() 
     868 
    866869function gen_manage_domain_query (&$search_query, &$count_query, 
    867870        $reseller_id, 
     
    870873        $search_for, 
    871874        $search_common, 
    872         $search_status) 
    873 
     875        $search_status) { 
    874876        // IMHO, this code is an unmaintainable mess and should be replaced - Cliff 
    875877        if ($search_for === 'n/a' && $search_common === 'n/a' && $search_status === 'n/a') { 
     
    991993        $search_for, 
    992994        $search_common, 
    993         $search_status) 
    994 
     995        $search_status) { 
    995996        if ($search_for === 'n/a' && $search_common === 'n/a' && $search_status === 'n/a') { 
    996997                // we have no search and let's genarate search fields empty 
     
    11021103} 
    11031104 
    1104 function gen_def_language(&$tpl, &$sql, &$user_def_language) 
    1105 
     1105function gen_def_language(&$tpl, &$sql, &$user_def_language) { 
    11061106        $matches = array(); 
    11071107        $languages = array(); 
     
    11571157} 
    11581158 
    1159 function gen_domain_details(&$tpl, &$sql, &$domain_id) 
    1160 
     1159function gen_domain_details(&$tpl, &$sql, &$domain_id) { 
    11611160        $tpl->assign('USER_DETAILS', ''); 
    11621161 
     
    12111210} 
    12121211 
    1213 function add_domain_extras(&$dmn_id, &$admin_id, &$sql) 
    1214 
     1212function add_domain_extras(&$dmn_id, &$admin_id, &$sql) { 
    12151213        $query = <<<SQL_QUERY 
    12161214        insert into domain_extras 
     
    12411239} 
    12421240 
    1243 function reseller_limits_check(&$sql, &$err_msg, $reseller_id, $hpid, $newprops = "") 
    1244 
     1241function reseller_limits_check(&$sql, &$err_msg, $reseller_id, $hpid, $newprops = "") { 
     1242        $error = false; 
     1243 
    12451244        if (empty($newprops)) { 
    12461245                // this hosting plan exists 
     
    13111310        if ($dmn_max != 0) { 
    13121311                if ($dmn_current + 1 > $dmn_max) { 
    1313                         $err_msg = tr('You have reached your domains limit.<br>You can not add more domains!'); 
    1314                         return
     1312                        set_page_message(tr('You have reached your domains limit.<br>You can not add more domains!')); 
     1313                        $error = true
    13151314                } 
    13161315        } 
     
    13191318                if ($sub_new != -1) { 
    13201319                        if ($sub_new == 0) { 
    1321                                 $err_msg = tr('You have a subdomains limit!<br>You can not add an user with unlimited subdomains!'); 
    1322                                 return
     1320                                set_page_message(tr('You have a subdomains limit!<br>You can not add an user with unlimited subdomains!')); 
     1321                                $error = true
    13231322                        } else if ($sub_current + $sub_new > $sub_max) { 
    1324                                 $err_msg = tr('You are exceeding your subdomains limit!'); 
    1325                                 return
     1323                                set_page_message(tr('You are exceeding your subdomains limit!')); 
     1324                                $error = true
    13261325                        } 
    13271326                } 
     
    13311330                if ($als_new != -1) { 
    13321331                        if ($als_new == 0) { 
    1333                                 $err_msg = tr('You have an aliases limit!<br>You can not add an user with unlimited aliases!'); 
    1334                                 return
     1332                                set_page_message(tr('You have an aliases limit!<br>You can not add an user with unlimited aliases!')); 
     1333                                $error = true
    13351334                        } else if ($als_current + $als_new > $als_max) { 
    1336                                 $err_msg = tr('You Are Exceeding Your Alias Limit!'); 
    1337                                 return
     1335                                set_page_message(tr('You Are Exceeding Your Alias Limit!')); 
     1336                                $error = true
    13381337                        } 
    13391338                } 
     
    13421341        if ($mail_max != 0) { 
    13431342                if ($mail_new == 0) { 
    1344                         $err_msg = tr('You have a mail accounts limit!<br>You can not add an user with unlimited mail accounts!'); 
    1345                         return
     1343                        set_page_message(tr('You have a mail accounts limit!<br>You can not add an user with unlimited mail accounts!')); 
     1344                        $error = true
    13461345                } else if ($mail_current + $mail_new > $mail_max) { 
    1347                         $err_msg = tr('You are exceeding your mail accounts limit!'); 
    1348                         return; 
     1346                        set_page_message(tr('You are exceeding your mail accounts limit!')); 
    13491347                } 
    13501348        } 
     
    13521350        if ($ftp_max != 0) { 
    13531351                if ($ftp_new == 0) { 
    1354                         $err_msg = tr('You have a FTP accounts limit!<br>You can not add an user with unlimited FTP accounts!'); 
    1355                         return
     1352                        set_page_message(tr('You have a FTP accounts limit!<br>You can not add an user with unlimited FTP accounts!')); 
     1353                        $error = true
    13561354                } else if ($ftp_current + $ftp_new > $ftp_max) { 
    1357                         $err_msg = tr('You are exceeding your FTP accounts limit!'); 
    1358                         return
     1355                        set_page_message(tr('You are exceeding your FTP accounts limit!')); 
     1356                        $error = true
    13591357                } 
    13601358        } 
     
    13631361                if ($sql_db_new != -1) { 
    13641362                        if ($sql_db_new == 0) { 
    1365                                 $err_msg = tr('You have a SQL databases limit!<br>You can not add an user with unlimited SQL databases!'); 
    1366                                 return
     1363                                set_page_message(tr('You have a SQL databases limit!<br>You can not add an user with unlimited SQL databases!')); 
     1364                                $error = true
    13671365                        } else if ($sql_db_current + $sql_db_new > $sql_db_max) { 
    1368                                 $err_msg = tr('You are exceeding your SQL databases limit!'); 
    1369                                 return
     1366                                set_page_message(tr('You are exceeding your SQL databases limit!')); 
     1367                                $error = true
    13701368                        } 
    13711369                } 
     
    13751373                if ($sql_user_new != -1) { 
    13761374                        if ($sql_user_new == 0) { 
    1377                                 $err_msg = tr('You have an SQL users limit!<br>You can not add an user with unlimited SQL users!'); 
    1378                                 return
     1375                                set_page_message(tr('You have an SQL users limit!<br>You can not add an user with unlimited SQL users!')); 
     1376                                $error = true
    13791377                        } else if ($sql_db_new == -1) { 
    1380                                 $err_msg = tr('You have disabled SQL databases for this user!<br>You can not have SQL users here!'); 
    1381                                 return
     1378                                set_page_message(tr('You have disabled SQL databases for this user!<br>You can not have SQL users here!')); 
     1379                                $error = true
    13821380                        } else if ($sql_user_current + $sql_user_new > $sql_user_max) { 
    1383                                 $err_msg = tr('You are exceeding your SQL database limit!'); 
    1384                                 return
     1381                                set_page_message(tr('You are exceeding your SQL database limit!')); 
     1382                                $error = true
    13851383                        } 
    13861384                } 
     
    13891387        if ($traff_max != 0) { 
    13901388                if ($traff_new == 0) { 
    1391                         $err_msg = tr('You have a traffic limit!<br>You can not add an user with unlimited traffic!'); 
    1392                         return
     1389                        set_page_message(tr('You have a traffic limit!<br>You can not add an user with unlimited traffic!')); 
     1390                        $error = true
    13931391                } else if ($traff_current + $traff_new > $traff_max) { 
    1394                         $err_msg = tr('You are exceeding your traffic limit!'); 
    1395                         return
     1392                        set_page_message(tr('You are exceeding your traffic limit!')); 
     1393                        $error = true
    13961394                } 
    13971395        } 
     
    13991397        if ($disk_max != 0) { 
    14001398                if ($disk_new == 0) { 
    1401                         $err_msg = tr('You have a disk limit!<br>You can not add an user with unlimited disk!'); 
    1402                         return
     1399                        set_page_message(tr('You have a disk limit!<br>You can not add an user with unlimited disk!')); 
     1400                        $error = true
    14031401                } else if ($disk_current + $disk_new > $disk_max) { 
    1404                         $err_msg = tr('You are exceeding your disk limit!'); 
    1405                         return; 
    1406                 } 
    1407         } 
     1402                        set_page_message(tr('You are exceeding your disk limit!')); 
     1403                        $error = true; 
     1404                } 
     1405        } 
     1406 
     1407        if ($error == true) { 
     1408                return false; 
     1409        } 
     1410 
     1411        return true; 
    14081412} 
     1413 
    14091414// Update reseller props 
    1410 function au_update_reseller_props($reseller_id, $props) 
    1411 
     1415function au_update_reseller_props($reseller_id, $props) { 
    14121416        global $sql; 
    14131417 
  • trunk/gui/reseller/ahp.php

    r784 r1005  
    44 * 
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    6  * @copyright   2006-2007 by ispCP | http://isp-control.net 
     6 * @copyright   2006-2008 by ispCP | http://isp-control.net 
    77 * @version     SVN: $ID$ 
    88 * @link                http://isp-control.net 
    9  * @author              ispCP Team (2007) 
     9 * @author              ispCP Team 
    1010 * 
    1111 * @license 
     
    272272        global $price, $setup_fee, $value, $payment, $status; 
    273273 
     274        $err_msg = ""; 
    274275        $query = "select id from hosting_plans where name = ? and reseller_id = ?"; 
    275276        $res = exec_query($sql, $query, array($hp_name, $admin_id)); 
     
    280281        } else { 
    281282                $hp_props = "$hp_php;$hp_cgi;$hp_sub;$hp_als;$hp_mail;$hp_ftp;$hp_sql_db;$hp_sql_user;$hp_traff;$hp_disk;"; 
    282  
    283                 $err_msg = '_off_'; 
    284283                // this id is just for fake and is not used in reseller_limits_check. 
    285                 $hpid = 99999999999999999999999999; 
    286  
    287                 reseller_limits_check($sql, $err_msg, $admin_id, $hpid, $hp_props); 
    288  
    289                 if ($err_msg != '_off_') { 
    290                         set_page_message($err_msg); 
    291                         return; 
    292                 } else { 
    293                         $query = <<<SQL_QUERY 
     284                $hpid = 0; 
     285 
     286                if (reseller_limits_check($sql, $err_msg, $admin_id, $hpid, $hp_props)) { 
     287                        if (!empty($err_msg)) { 
     288                                set_page_message($err_msg); 
     289                                return false; 
     290                        } else { 
     291                                $query = <<<SQL_QUERY 
    294292        insert into 
    295293            hosting_plans(reseller_id, 
     
    304302        values (?, ?, ?, ?, ?, ?, ?, ?, ?) 
    305303SQL_QUERY; 
    306                         $res = exec_query($sql, $query, array($admin_id, $hp_name, $description, $hp_props, $price, $setup_fee, $value, $payment, $status)); 
    307  
    308                         $_SESSION['hp_added'] = '_yes_'; 
    309                         Header("Location: ehp.php"); 
    310                         die(); 
     304                                $res = exec_query($sql, $query, array($admin_id, $hp_name, $description, $hp_props, $price, $setup_fee, $value, $payment, $status)); 
     305 
     306                                $_SESSION['hp_added'] = '_yes_'; 
     307                                header("Location: ehp.php"); 
     308                                die(); 
     309                        } 
    311310                } 
     311                else { 
     312                        set_page_message(tr("Hosting plan values exceed reseller maximum values!")); 
     313                        return false; 
     314                } 
    312315        } 
    313316} //End of save_data_to_db() 
  • trunk/gui/reseller/domain_alias.php

    r880 r1005  
    44 * 
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    6  * @copyright   2006-2007 by ispCP | http://isp-control.net 
     6 * @copyright   2006-2008 by ispCP | http://isp-control.net 
    77 * @version     SVN: $ID$ 
    88 * @link                http://isp-control.net 
    9  * @author              ispCP Team (2007) 
     9 * @author              ispCP Team 
    1010 * 
    1111 * @license 
  • trunk/gui/reseller/ehp.php

    r784 r1005  
    44 * 
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    6  * @copyright   2006-2007 by ispCP | http://isp-control.net 
     6 * @copyright   2006-2008 by ispCP | http://isp-control.net 
    77 * @version     SVN: $ID$ 
    88 * @link                http://isp-control.net 
    9  * @author              ispCP Team (2007) 
     9 * @author              ispCP Team 
    1010 * 
    1111 * @license 
     
    324324        global $hpid; 
    325325 
     326        $err_msg = ""; 
    326327        $description = clean_input($_POST['hp_description']); 
    327328        $price = clean_input($_POST['hp_price']); 
     
    333334        $hp_props = "$hp_php;$hp_cgi;$hp_sub;$hp_als;$hp_mail;$hp_ftp;$hp_sql_db;$hp_sql_user;$hp_traff;$hp_disk;"; 
    334335 
    335         $err_msg = '_off_'; 
    336  
    337336        $admin_id = $_SESSION['user_id']; 
    338337 
    339         reseller_limits_check($sql, $err_msg, $admin_id, $hpid, $hp_props); 
    340  
    341         if ($err_msg != '_off_') { 
    342                 set_page_message($err_msg); 
    343                 restore_form($tpl, $sql); 
    344         } else { 
    345                 $query = <<<SQL_QUERY 
     338        if (reseller_limits_check($sql, $err_msg, $admin_id, $hpid, $hp_props)) { 
     339 
     340                if (!empty($err_msg)) { 
     341                        set_page_message($err_msg); 
     342                        restore_form($tpl, $sql); 
     343                        return false; 
     344                } else { 
     345                        $query = <<<SQL_QUERY 
    346346        update 
    347347            hosting_plans 
     
    358358            id = ? 
    359359SQL_QUERY; 
    360                 $res = exec_query($sql, $query, array($hp_name, $description, $hp_props, $price, 
     360                       $res = exec_query($sql, $query, array($hp_name, $description, $hp_props, $price, 
    361361                                $setup_fee, $currency, $payment, $status, $hpid)); 
    362362 
    363                 $_SESSION['hp_updated'] = '_yes_'; 
    364                 Header("Location: hp.php"); 
    365                 die(); 
     363                        $_SESSION['hp_updated'] = '_yes_'; 
     364                        header("Location: hp.php"); 
     365                        die(); 
     366                } 
     367        } 
     368        else { 
     369                set_page_message(tr("Hosting plan values exceed reseller maximum values!")); 
     370                return false; 
    366371        } 
    367372} //End of save_data_to_db() 
  • trunk/gui/reseller/orders_add.php

    r678 r1005  
    11<?php 
    22/** 
    3  * ispCP (OMEGA) - Virtual Hosting Control System | Omega Version 
     3 * ispCP ω (OMEGA) a Virtual Hosting Control System 
    44 * 
    5  *  @copyright  2001-2006 by moleSoftware GmbH 
    6  *  @copyright  2006-2007 by ispCP | http://isp-control.net 
    7  *  @link               http://isp-control.net 
    8  *  @author             ispCP Team (2007) 
     5 * @copyright   2001-2006 by moleSoftware GmbH 
     6 * @copyright   2006-2008 by ispCP | http://isp-control.net 
     7 * @version     SVN: $ID$ 
     8 * @link                http://isp-control.net 
     9 * @author              ispCP Team 
    910 * 
    10  * @license 
    11  *  This program is free software; you can redistribute it and/or modify it under 
    12  *  the terms of the MPL General Public License as published by the Free Software 
    13  *  Foundation; either version 1.1 of the License, or (at your option) any later 
    14  *  version. 
    15  *  You should have received a copy of the MPL Mozilla Public License along with 
    16  *  this program; if not, write to the Open Source Initiative (OSI) 
    17  *  http://opensource.org | osi@opensource.org 
    18  **
     11 * @license 
     12 *  This program is free software; you can redistribute it and/or modify it under 
     13 *  the terms of the MPL General Public License as published by the Free Software 
     14 *  Foundation; either version 1.1 of the License, or (at your option) any later 
     15 *  version. 
     16 *  You should have received a copy of the MPL Mozilla Public License along with 
     17 *  this program; if not, write to the Open Source Initiative (OSI) 
     18 *  http://opensource.org | osi@opensource.org 
     19 *
    1920 
    2021require '../include/ispcp-lib.php'; 
     
    2425$reseller_id = $_SESSION['user_id']; 
    2526 
    26  
    27 if(isset($_GET['order_id']) && is_numeric($_GET['order_id'])){ 
     27if (isset($_GET['order_id']) && is_numeric($_GET['order_id'])) { 
    2828        $order_id = $_GET['order_id']; 
    29 }else
     29} else
    3030        set_page_message(tr('Wrong order ID!')); 
    3131        Header("Location: orders.php"); 
     
    3333} 
    3434 
    35 if (isset($cfg['HOSTING_PLANS_LEVEL']) && $cfg['HOSTING_PLANS_LEVEL'] === 'admin')
     35if (isset($cfg['HOSTING_PLANS_LEVEL']) && $cfg['HOSTING_PLANS_LEVEL'] === 'admin')
    3636        $query = <<<SQL_QUERY 
    3737        select 
     
    4444 
    4545        $rs = exec_query($sql, $query, array($order_id)); 
    46  
    47  
    4846} else { 
    49  
    50 $query = <<<SQL_QUERY 
     47        $query = <<<SQL_QUERY 
    5148        select 
    5249                * 
     
    6057 
    6158        $rs = exec_query($sql, $query, array($order_id, $reseller_id)); 
    62         } 
    63  
    64                 if ($rs -> RecordCount() == 0 ||  !isset($_SESSION['domain_ip'])) { 
    65  
    66                         set_page_message(tr('Permission deny!')); 
    67                         header('Location: orders.php'); 
    68                         die(); 
    69                 } 
     59
     60 
     61if ($rs->RecordCount() == 0 || !isset($_SESSION['domain_ip'])) { 
     62        set_page_message(tr('Permission deny!')); 
     63        header('Location: orders.php'); 
     64        die(); 
     65
    7066 
    7167$domain_ip = $_SESSION['domain_ip']; 
    72 $dmn_user_name = $rs -> fields['domain_name']; 
     68$dmn_user_name = $rs->fields['domain_name']; 
    7369$dmn_user_name = decode_idna($dmn_user_name); 
    7470 
    75 $hpid = $rs -> fields['plan_id']; 
    76 $first_name = $rs -> fields['fname']; 
    77 $last_name = $rs -> fields['lname']; 
    78 $firm = $rs -> fields['firm']; 
    79 $zip = $rs -> fields['zip']; 
    80 $city = $rs -> fields['city']; 
    81 $country = $rs -> fields['country']; 
    82 $phone = $rs -> fields['phone']; 
    83 $fax = $rs -> fields['fax']; 
    84 $street_one = $rs -> fields['street1']; 
    85 $street_two = $rs -> fields['street2']; 
    86 $customer_id = $rs -> fields['customer_id']; 
    87 $user_email = $rs -> fields['email']; 
    88  
    89 //lets check the reseller limits 
    90 $err_msg = '_off_'; 
    91  
    92         if (isset($cfg['HOSTING_PLANS_LEVEL']) && $cfg['HOSTING_PLANS_LEVEL'] === 'admin'){ 
    93                 $query = "select props from hosting_plans where id = ?"; 
    94             $res = exec_query($sql, $query, array($hpid)); 
    95         } else { 
    96         $query = "select props from hosting_plans where reseller_id = ? and id = ?"; 
    97             $res = exec_query($sql, $query, array($reseller_id, $hpid)); 
    98         } 
    99     $data = $res -> FetchRow(); 
    100     $props = $data['props']; 
    101  
    102         $_SESSION["ch_hpprops"] = $props; 
    103  
    104         reseller_limits_check($sql, $err_msg, $reseller_id, $hpid); 
    105 if ($err_msg != '_off_') { 
     71$hpid = $rs->fields['plan_id']; 
     72$first_name = $rs->fields['fname']; 
     73$last_name = $rs->fields['lname']; 
     74$firm = $rs->fields['firm']; 
     75$zip = $rs->fields['zip']; 
     76$city = $rs->fields['city']; 
     77$country = $rs->fields['country']; 
     78$phone = $rs->fields['phone']; 
     79$fax = $rs->fields['fax']; 
     80$street_one = $rs->fields['street1']; 
     81$street_two = $rs->fields['street2']; 
     82$customer_id = $rs->fields['customer_id']; 
     83$user_email = $rs->fields['email']; 
     84// lets check the reseller limits 
     85$err_msg = ""; 
     86 
     87if (isset($cfg['HOSTING_PLANS_LEVEL']) && $cfg['HOSTING_PLANS_LEVEL'] === 'admin') { 
     88        $query = "select props from hosting_plans where id = ?"; 
     89        $res = exec_query($sql, $query, array($hpid)); 
     90} else { 
     91        $query = "select props from hosting_plans where reseller_id = ? and id = ?"; 
     92        $res = exec_query($sql, $query, array($reseller_id, $hpid)); 
     93
     94$data = $res->FetchRow(); 
     95$props = $data['props']; 
     96 
     97$_SESSION["ch_hpprops"] = $props; 
     98 
     99if (!reseller_limits_check($sql, $err_msg, $reseller_id, $hpid)) { 
     100        set_page_message(tr("Order Canceled: resellers maximum exceeded!")); 
     101        header('Location: orders.php'); 
     102        die(); 
     103
     104 
     105if (!empty($err_msg)) { 
    106106        set_page_message($err_msg); 
    107107        unset($_SESSION['domain_ip']); 
     
    109109        die(); 
    110110} 
    111        unset($_SESSION["ch_hpprops"]); 
    112   list($php, $cgi, $sub, 
    113        $als, $mail, $ftp, 
    114        $sql_db, $sql_user, 
    115        $traff, $disk) = explode(";", $props); 
    116  
    117   $php = preg_replace("/\_/", "", $php); 
    118   $cgi = preg_replace("/\_/", "", $cgi); 
    119  
    120        $timestamp = time(); 
    121        $pure_user_pass = substr($timestamp,0,6); 
    122        $inpass = crypt_user_pass($pure_user_pass); 
    123  
    124        if (!chk_dname($dmn_user_name)) { 
    125         set_page_message(tr('Wrong domain name syntax!')); 
    126                unset($_SESSION['domain_ip']); 
    127                header('Location: orders.php'); 
    128                die(); 
    129  
    130     } if (ispcp_domain_exists($dmn_user_name, $_SESSION['user_id'])) { 
    131                set_page_message(tr('Domain with that name already exists on the system!')); 
    132                unset($_SESSION['domain_ip']); 
    133                header('Location: orders.php'); 
    134                die(); 
    135    
    136  
    137   check_for_lock_file(); 
    138  
    139   $query = <<<ISPCP_SQL_QUERY 
     111unset($_SESSION["ch_hpprops"]); 
     112list($php, $cgi, $sub, 
     113       $als, $mail, $ftp, 
     114       $sql_db, $sql_user, 
     115       $traff, $disk) = explode(";", $props); 
     116 
     117$php = preg_replace("/\_/", "", $php); 
     118$cgi = preg_replace("/\_/", "", $cgi); 
     119 
     120$timestamp = time(); 
     121$pure_user_pass = substr($timestamp, 0, 6); 
     122$inpass = crypt_user_pass($pure_user_pass); 
     123 
     124if (!chk_dname($dmn_user_name)) { 
     125       set_page_message(tr('Wrong domain name syntax!')); 
     126        unset($_SESSION['domain_ip']); 
     127        header('Location: orders.php'); 
     128        die(); 
     129
     130if (ispcp_domain_exists($dmn_user_name, $_SESSION['user_id'])) { 
     131        set_page_message(tr('Domain with that name already exists on the system!')); 
     132        unset($_SESSION['domain_ip']); 
     133        header('Location: orders.php'); 
     134        die(); 
     135
     136 
     137check_for_lock_file(); 
     138 
     139$query = <<<ISPCP_SQL_QUERY 
    140140            insert into admin 
    141141                      ( 
     
    153153ISPCP_SQL_QUERY; 
    154154 
    155     $res = exec_query($sql, $query, array($dmn_user_name, $inpass, $reseller_id, $first_name, $last_name, 
    156                       $firm, $zip, $city, $country, $user_email, $phone, $fax, $street_one, $street_two, $customer_id)); 
    157  
    158     print $sql -> ErrorMsg(); 
    159  
    160     $record_id = $sql -> Insert_ID(); 
     155$res = exec_query($sql, $query, array($dmn_user_name, $inpass, $reseller_id, $first_name, $last_name, 
     156               $firm, $zip, $city, $country, $user_email, $phone, $fax, $street_one, $street_two, $customer_id)); 
     157 
     158print $sql->ErrorMsg(); 
     159 
     160$record_id = $sql->Insert_ID(); 
    161161 
    162162$query = <<<SQL_QUERY 
     
    170170SQL_QUERY; 
    171171 
    172         $rs = exec_query($sql, $query, array($reseller_id)); 
    173         $domain_ip = $rs -> fields['reseller_ips']; 
    174  
    175  
    176     $query = <<<ISPCP_SQL_QUERY 
     172$rs = exec_query($sql, $query, array($reseller_id)); 
     173$domain_ip = $rs->fields['reseller_ips']; 
     174 
     175$query = <<<ISPCP_SQL_QUERY 
    177176            insert into domain ( 
    178177                        domain_name, domain_admin_id, 
     
    197196ISPCP_SQL_QUERY; 
    198197 
    199     $res = exec_query($sql, $query, array($dmn_user_name, 
    200                                           $record_id, 
    201                                           $reseller_id, 
    202                                           $mail, 
    203                                           $ftp, 
    204                                           $traff, 
    205                                           $sql_db, 
    206                                           $sql_user, 
    207                                           $sub, 
    208                                           $als, 
    209                                           $domain_ip, 
    210                                           $disk, 
    211                                           $php, 
    212                                           $cgi)); 
    213     $dmn_id = $sql -> Insert_ID(); 
    214  
    215         // ispcp 2.5 feature 
    216         //add_domain_extras($dmn_id, $record_id, $sql); 
    217  
    218  
    219         // lets send mail to user 
    220         send_add_user_auto_msg ( 
    221                                 $reseller_id, 
    222                                 $dmn_user_name, 
    223                                 $pure_user_pass, 
    224                                 $user_email, 
    225                                 $first_name, 
    226                                 $last_name, 
    227                                  tr('Domain account') 
    228                                ); 
    229  
    230     // send query to the ispcp daemon 
    231  
    232  
    233   // add user into user_gui_props => domain looser needs language and skin too :-) 
    234  
    235   $user_def_lang = $_SESSION['user_def_lang']; 
    236   $user_theme_color = $_SESSION['user_theme']; 
    237  
    238   $query = <<<SQL_QUERY 
     198$res = exec_query($sql, $query, array($dmn_user_name, 
     199                $record_id, 
     200                $reseller_id, 
     201                $mail, 
     202                $ftp, 
     203                $traff, 
     204                $sql_db, 
     205                $sql_user, 
     206                $sub, 
     207                $als, 
     208                $domain_ip, 
     209                $disk, 
     210                $php, 
     211                $cgi)); 
     212$dmn_id = $sql->Insert_ID(); 
     213// ispcp 2.5 feature 
     214// add_domain_extras($dmn_id, $record_id, $sql); 
     215// lets send mail to user 
     216send_add_user_auto_msg ($reseller_id, 
     217        $dmn_user_name, 
     218        $pure_user_pass, 
     219        $user_email, 
     220        $first_name, 
     221        $last_name, 
     222        tr('Domain account') 
     223        ); 
     224// send query to the ispcp daemon 
     225// add user into user_gui_props => domain looser needs language and skin too :-) 
     226$user_def_lang = $_SESSION['user_def_lang']; 
     227$user_theme_color = $_SESSION['user_theme']; 
     228 
     229$query = <<<SQL_QUERY 
    239230