Example #1
0
 function Create($operate_array, $create_array, $client_options_array)
 {
     $soap_location = "http://" . $operate_array['ip'] . ":" . $operate_array['port'] . "/remote/index.php";
     $soap_uri = "http://" . $operate_array['ip'] . ":" . $operate_array['port'] . "/remote/";
     $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri));
     if ($session_id = $client->login($username, $password)) {
         $arr = $client_options_array;
         $arr['contact_name'] = $create_array['clientlogin'];
         $arr['username'] = $create_array['clientlogin'];
         $arr['password'] = $create_array['clientpassword'];
         if ($client->client_add($session_id, false, $arr)) {
             if ($client->logout($session_id)) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
         /*
         $arr['limit_maildomain'] =
         $arr['limit_mailbox'] =
         $arr['limit_mailalias'] =
         $arr['limit_mailaliasdomain'] =
         $arr['limit_mailforward'] =
         $arr['limit_mailcatchall'] =
         $arr['limit_mailrouting'] =
         $arr['limit_mailfilter'] =
         $arr['limit_fetchmail'] =
         $arr['limit_mailquota'] =
         $arr['limit_spamfilter_wblist'] =
         $arr['limit_spamfilter_user'] =
         $arr['limit_spamfilter_policy'] =
         $arr['limit_web_domain'] =
         $arr['limit_web_quota'] =
         $arr['web_php_options'] =
         $arr['limit_web_aliasdomain'] =
         $arr['limit_web_subdomain'] =
         $arr['limit_ftp_user'] =
         $arr['limit_shell_user'] =
         $arr['ssh_chroot'] =
         $arr['limit_webdav_user'] =
         $arr['limit_dns_zone'] =
         $arr['limit_dns_slave_zone'] =
         $arr['limit_dns_record'] =
         $arr['limit_client'] =
         $arr['limit_database'] =
         $arr['limit_cron'] =
         $arr['limit_cron_type'] =
         $arr['limit_cron_frequency'] =
         $arr['limit_traffic_quota'] =
         */
     } else {
         return false;
     }
 }
Example #2
0
<?php

require 'soap_config.php';
$client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1));
try {
    if ($session_id = $client->login($username, $password)) {
        echo 'Logged successfull. Session ID:' . $session_id . '<br />';
    }
    //* Set the function parameters.
    $random_rs_id = 1;
    $params = array('company_name' => 'awesomecompany', 'contact_name' => 'name', 'customer_no' => '1', 'vat_id' => '1', 'street' => 'fleetstreet', 'zip' => '21337', 'city' => 'london', 'state' => 'bavaria', 'country' => 'UK', 'telephone' => '123456789', 'mobile' => '987654321', 'fax' => '546718293', 'email' => '*****@*****.**', 'internet' => '', 'icq' => '111111111', 'notes' => 'awesome', 'dafault_mailserver' => 1, 'limit_maildomain' => -1, 'limit_mailbox' => -1, 'limit_mailalias' => -1, 'limit_mailaliasdomain' => -1, 'limit_mailforward' => -1, 'limit_mailcatchall' => -1, 'limit_mailrouting' => 0, 'limit_mailfilter' => -1, 'limit_fetchmail' => -1, 'limit_mailquota' => -1, 'limit_spamfilter_wblist' => 0, 'limit_spamfilter_user' => 0, 'limit_spamfilter_policy' => 1, 'default_webserver' => 1, 'limit_web_ip' => '', 'limit_web_domain' => -1, 'limit_web_quota' => -1, 'web_php_options' => 'no,fast-cgi,cgi,mod,suphp', 'limit_web_subdomain' => -1, 'limit_web_aliasdomain' => -1, 'limit_ftp_user' => -1, 'limit_shell_user' => 0, 'ssh_chroot' => 'no,jailkit,ssh-chroot', 'limit_webdav_user' => 0, 'default_dnsserver' => 1, 'limit_dns_zone' => -1, 'limit_dns_slave_zone' => -1, 'limit_dns_record' => -1, 'default_dbserver' => 1, 'limit_database' => -1, 'limit_cron' => 0, 'limit_cron_type' => 'url', 'limit_cron_frequency' => 5, 'limit_traffic_quota' => -1, 'limit_client' => 0, 'parent_client_id' => 0, 'username' => 'guy', 'password' => 'brush', 'language' => 'en', 'usertheme' => 'default', 'template_master' => 0, 'template_additional' => '', 'created_at' => 0);
    $affected_rows = $client->client_add($session_id, $random_rs_id, $params);
    echo "Client: " . $affected_rows . "<br>";
    if ($client->logout($session_id)) {
        echo 'Logged out.<br />';
    }
} catch (SoapFault $e) {
    echo $client->__getLastResponse();
    die('SOAP Error: ' . $e->getMessage());
}
Example #3
0
function ISPConfig_Create($Settings, $Login, $Password, $Domain, $IP, $HostingScheme, $Email, $PersonID = 'Default', $Person = array())
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'string', 'string', 'string', 'array', 'string', 'string', 'array');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    //  $IDNA = new Net_IDNA_php5();
    //  $Domain = $IDNA->encode($Domain);
    #-----------------------------------------------------------------------------
    if ($HostingScheme['PackageID'] == '' or $HostingScheme['PackageID'] == 'MB500') {
        $HostingScheme['PackageID'] = 0;
    }
    $ISPConfigPHP = "no";
    if ($HostingScheme['IsPHPFastCGIAccess'] == 'yes') {
        $ISPConfigPHP = $ISPConfigPHP . ",fast-cgi";
    }
    if ($HostingScheme['IsPHPCGIAccess'] == 'yes') {
        $ISPConfigPHP = $ISPConfigPHP . ",cgi";
    }
    if ($HostingScheme['IsPHPModAccess'] == 'yes') {
        $ISPConfigPHP = $ISPConfigPHP . ",mod";
    }
    //  if ($HostingScheme['']=='yes') { $ISPConfigPHP = $ISPConfigPHP.",suphp"; } #!!! нет в тарифах suphp
    //  if ($HostingScheme['']=='yes') { $ISPConfigPerl = 'y'; }else{ $ISPConfigPerl = 'n'; }; # limit_perl
    //  if ($HostingScheme['']=='yes') { $ISPConfigRuby = 'y'; }else{ $ISPConfigRuby = 'n'; }; # limit_ruby
    //  if ($HostingScheme['']=='yes') { $ISPConfigPython = 'y'; }else{ $ISPConfigPython = 'n'; }; # limit_python
    //  if ($HostingScheme['']=='yes') { $ISPConfigSuexec = 'y'; }else{ $ISPConfigSuexec = 'n'; }; #!!! force_suexec
    //  if ($HostingScheme['']=='yes') { $ISPConfigHterror = 'y'; }else{ $ISPConfigHterror = 'n'; }; # limit_hterror Custom error docs available
    //  if ($HostingScheme['']=='yes') { $ISPConfigWildcard = 'y'; }else{ $ISPConfigWildcard = 'n'; }; # limit_wildcard Wildcard subdomain available
    //  if ($HostingScheme['']=='yes') { $ISPConfigBackup = 'y'; }else{ $ISPConfigBackup = 'n'; }; # limit_backup Разрешить резервное копирование
    $Request = array('contact_name' => $Login, 'country' => 'RU', 'default_mailserver' => 1, 'limit_maildomain' => $HostingScheme['QuotaEmailDomains'], 'limit_mailbox' => $HostingScheme['QuotaEmail'], 'limit_mailalias' => -1, 'limit_mailaliasdomain' => -1, 'limit_mailforward' => $HostingScheme['QuotaEmailForwards'], 'limit_mailcatchall' => -1, 'limit_mailrouting' => -1, 'limit_mailfilter' => -1, 'limit_fetchmail' => -1, 'limit_mailquota' => $HostingScheme['QuotaEmailBox'], 'limit_spamfilter_wblist' => 1, 'limit_spamfilter_user' => 1, 'limit_spamfilter_policy' => 1, 'default_webserver' => 1, 'limit_web_ip' => '', 'limit_web_domain' => $HostingScheme['QuotaWWWDomains'], 'limit_web_quota' => $HostingScheme['QuotaDisk'], 'web_php_options' => $ISPConfigPHP, 'limit_cgi' => $HostingScheme['IsCGIAccess'] ? 'y' : 'n', 'limit_ssi' => $HostingScheme['IsSSIAccess'] ? 'y' : 'n', 'limit_perl' => 'y', 'limit_ruby' => 'y', 'limit_python' => 'y', 'force_suexec' => 'y', 'limit_hterror' => 'y', 'limit_wildcard' => 'y', 'limit_ssl' => $HostingScheme['IsSSLAccess'] ? 'y' : 'n', 'limit_web_subdomain' => $HostingScheme['QuotaSubDomains'], 'limit_web_aliasdomain' => $HostingScheme['QuotaParkDomains'], 'limit_ftp_user' => $HostingScheme['QuotaFTP'], 'limit_shell_user' => 0, 'ssh_chroot' => 'no', 'limit_webdav_user' => 0, 'limit_backup' => 'y', 'limit_aps' => $HostingScheme['QuotaWebApp'], 'default_dnsserver' => 1, 'limit_dns_zone' => $HostingScheme['QuotaWWWDomains'], 'default_slave_dnsserver' => 1, 'limit_dns_slave_zone' => $HostingScheme['QuotaWWWDomains'], 'limit_dns_record' => -1, 'default_dbserver' => 1, 'limit_database' => $HostingScheme['QuotaDBs'], 'limit_database_quota' => -1, 'limit_cron' => $HostingScheme['QuotaDomains'], 'limit_cron_type' => 'full', 'limit_cron_frequency' => 5, 'limit_traffic_quota' => $HostingScheme['QuotaTraffic'], 'limit_client' => 0, 'limit_mailmailinglist' => $HostingScheme['QuotaEmailLists'], 'parent_client_id' => 0, 'username' => $Login, 'password' => $Password, 'language' => 'ru', 'usertheme' => 'default', 'template_master' => $HostingScheme['PackageID'], 'template_additional' => '', 'created_at' => 0);
    $reseller_id = 0;
    // this id has to be 0 if the client shall not be assigned to admin or if the client is a reseller
    #-----------------------------------------------------------------------------
    # Содаем подключение к панели ISPConfig
    $SoapLocation = SPrintF('%s://%s:%u/remote/index.php', $Settings['Protocol'] == 'ssl' ? 'https' : 'http', $Settings['Address'], $Settings['Port']);
    $SoapUri = SPrintF('%s://%s:%u/remote/', $Settings['Protocol'] == 'ssl' ? 'https' : 'http', $Settings['Address'], $Settings['Port']);
    $client = new SoapClient(null, array('location' => $SoapLocation, 'uri' => $SoapUri, 'trace' => 1, 'exceptions' => 1));
    # Открываем сессию на панели ISPConfig
    $session_id = $client->login($Settings['Login'], $Settings['Password']);
    # Отправляем данные нового пользователя в панеь ISPConfig
    try {
        $client->client_add($session_id, $reseller_id, $Request);
        $Response = $client->__getLastResponse();
    } catch (SoapFault $Result) {
        $Response = $client->__getLastResponse();
        $Response = Strip_Tags($Response);
    }
    #-----------------------------------------------------------------------------
    # Запрашиваем ID клиента и ID группы клиента
    $client_id = ISPConfig_ClientID($session_id, $client, $Login);
    //	$client_group_id = ISPConfig_ClientGetGroupID($session_id,$client,$client_id);
    #-----------------------------------------------------------------------------
    # Добавляем клиенту домен
    $AddDomain = array('domain' => $Domain);
    try {
        $client->domains_domain_add($session_id, $client_id, $AddDomain);
        $Response = $client->__getLastResponse();
    } catch (SoapFault $Result) {
        $Response = $client->__getLastResponse();
        $Response = Strip_Tags($Response);
    }
    #-----------------------------------------------------------------------------
    # Закрываем сессию на сервере ISPConfig
    $client->logout($session_id);
    #-----------------------------------------------------------------------------
    # Проверяем ответ панели на ошибку запроса
    if (Preg_Match('/data_processing_error/', $Response)) {
        return new gException('WRONG_ANSWER', $Response);
    } else {
        return TRUE;
    }
}
Example #4
0
function ispcfg3_CreateAccount($params)
{
    $productid = $params['pid'];
    $accountid = $params['accountid'];
    $domain = strtolower($params['domain']);
    $username = $params['username'];
    $password = $params['password'];
    $clientsdetails = $params['clientsdetails'];
    $soapuser = $params['configoption1'];
    $soappassword = $params['configoption2'];
    $soapsvrurl = $params['configoption3'];
    $soapsvrssl = $params['configoption4'];
    $templateid = $params['configoption5'];
    $designtheme = $params['configoption6'];
    $globalphp = $params['configoption7'];
    $chrootenable = $params['configoption8'];
    $webcreation = $params['configoption9'];
    $domaintool = $params['configoption10'];
    $webwriteprotect = $params['configoption11'];
    $webquota = $params['configoption12'];
    $webtraffic = $params['configoption13'];
    $websettings = explode(',', $params['configoption14']);
    $subdomain = $params['configoption15'];
    $phpmode = $params['configoption16'];
    $webactive = $params['configoption17'];
    $dns = $params['configoption18'];
    $dnssettings = explode(',', $params['configoption19']);
    $defaultlanguage = $params['configoption20'];
    $addmaildomain = $params['configoption21'];
    $addftpuser = $params['configoption22'];
    $nameserver1 = $dnssettings[0];
    $nameserver2 = $dnssettings[1];
    $soaemail = $dnssettings[2] . '.' . $domain;
    $dnstemplate = $dnssettings[3];
    $zoneip = $dnssettings[4];
    $websettings[0] == 'n' ? $enablecgi = '' : ($enablecgi = 'y');
    $websettings[1] == 'n' ? $enablessi = '' : ($enablessi = 'y');
    $websettings[2] == 'n' ? $enableperl = '' : ($enableperl = 'y');
    $websettings[3] == 'n' ? $enableruby = '' : ($enableruby = 'y');
    $websettings[4] == 'n' ? $enablepython = '' : ($enablepython = 'y');
    $websettings[5] == 'n' ? $enablesuexec = '' : ($enablesuexec = 'y');
    $websettings[6] == 'n' ? $enableerrdocs = '' : ($enableerrdocs = '1');
    $websettings[7] == 'n' ? $wildcardsubdom = '' : ($wildcardsubdom = '1');
    $websettings[8] == 'n' ? $enablessl = '' : ($enablessl = 'y');
    $webactive == 'on' ? $webactive = 'y' : ($webactive = 'n');
    logModuleCall('ispconfig', 'CreateClient', $params['clientsdetails'], $params, '', '');
    if ($soapsvrssl == 'on') {
        $soap_url = 'https://' . $soapsvrurl . '/remote/index.php';
        $soap_uri = 'https://' . $soapsvrurl . '/remote/';
    } else {
        $soap_url = 'http://' . $soapsvrurl . '/remote/index.php';
        $soap_uri = 'http://' . $soapsvrurl . '/remote/';
    }
    /* 
     * Make sure that a username and password have been set
     * or exit with error.
     */
    if (isset($username) && $username != '' && (isset($password) && $password != '')) {
        try {
            /* Connect to SOAP Server */
            $client = new SoapClient(null, array('location' => $soap_url, 'uri' => $soap_uri, 'exceptions' => 1, 'trace' => false));
            /* Authenticate with the SOAP Server */
            $session_id = $client->login($soapuser, $soappassword);
            $fullname = htmlspecialchars_decode($clientsdetails['firstname']);
            $fullname .= ' ' . htmlspecialchars_decode($clientsdetails['lastname']);
            $companyname = htmlspecialchars_decode($clientsdetails['companyname']);
            $address = $clientsdetails['address1'];
            if (!empty($clientsdetails['address2'])) {
                $address .= ',' . $clientsdetails['address2'];
            }
            $zip = $clientsdetails['postcode'];
            $city = $clientsdetails['city'];
            $state = $clientsdetails['state'];
            $mail = $clientsdetails['email'];
            $country = $clientsdetails['country'];
            $phonenumber = $clientsdetails['phonenumberformatted'];
            $customerno = $clientsdetails['userid'];
            /* Get the serverid's from WHMCS */
            $sql = 'SELECT serverid FROM tblservergroupsrel WHERE groupid  = ' . '( SELECT servergroup FROM tblproducts ' . 'WHERE id = "' . $productid . '")';
            $res = mysql_query($sql);
            $servernames = array();
            /* Loop through the serverid's and retrieve the hostnames of the
             * servers from WHMCS
             */
            $i = 0;
            while ($groupservers = mysql_fetch_array($res)) {
                $sql = 'SELECT hostname FROM tblservers ' . 'WHERE id  = "' . $groupservers['serverid'] . '"';
                $db_result = mysql_query($sql);
                $servernames2 = mysql_fetch_array($db_result);
                $servernames[$i] = $servernames2['hostname'];
                $i++;
            }
            $a = 0;
            $b = 0;
            $c = 0;
            $d = 0;
            $e = 0;
            $i = 0;
            $j = 1;
            $server = array();
            while ($j <= count($servernames)) {
                /* Retreive the serverid from ispconfig */
                $result = $client->server_get_serverid_by_name($session_id, $servernames[$i]);
                /* Retrieve the services for the server from ispconfig */
                $servicesresult = $client->server_get_functions($session_id, $result[0]['server_id']);
                /* Loop through the results to find the services on each server */
                if ($servicesresult[0]['mail_server'] == 1) {
                    $server['mail_server'][$a]['server_id'] = $result[0]['server_id'];
                    $server['mail_server'][$a]['hostname'] = $servernames[$i];
                    $a++;
                }
                if ($servicesresult[0]['web_server'] == 1) {
                    $server['web_server'][$b]['server_id'] = $result[0]['server_id'];
                    $server['web_server'][$b]['hostname'] = $servernames[$i];
                    $b++;
                }
                if ($servicesresult[0]['dns_server'] == 1) {
                    $server['dns_server'][$c]['server_id'] = $result[0]['server_id'];
                    $server['dns_server'][$c]['hostname'] = $servernames[$i];
                    $c++;
                }
                if ($servicesresult[0]['file_server'] == 1) {
                    $server['file_server'][$d]['server_id'] = $result[0]['server_id'];
                    $server['file_server'][$d]['hostname'] = $servernames[$i];
                    $d++;
                }
                if ($servicesresult[0]['db_server'] == 1) {
                    $server['db_server'][$e]['server_id'] = $result[0]['server_id'];
                    $server['db_server'][$e]['hostname'] = $servernames[$i];
                    $e++;
                }
                ++$i;
                ++$j;
            }
            unset($a);
            unset($b);
            unset($c);
            unset($d);
            unset($e);
            logModuleCall('ispconfig', 'CreateClient', $servicesresult, $server, '', '');
            if (count($server['mail_server']) == 1) {
                $defaultmailserver = $server['mail_server'][0]['server_id'];
            } else {
                $rnd = rand(0, count($server['mail_server']) - 1);
                $defaultmailserver = $server['mail_server'][$rnd]['server_id'];
            }
            if (count($server['web_server']) == 1) {
                $defaultwebserver = $server['web_server'][0]['server_id'];
            } else {
                $a = 1;
                $b = 0;
                while ($a <= count($server['web_server'])) {
                    $result = array();
                    $result = $client->sites_web_domain_get($session_id, array('server_id' => $server['web_server'][$b]['server_id'], 'type' => 'vhost'));
                    if (!isset($webservercnt)) {
                        $webservercnt = count(array_keys($result));
                    }
                    if ($webservercnt > count(array_keys($result)) or !isset($defaultwebserver)) {
                        $webservercnt = count(array_keys($result));
                        $defaultwebserver = $server['web_server'][$b]['server_id'];
                    }
                    $a++;
                    $b++;
                }
                unset($a);
                unset($b);
            }
            if (count($server['db_server']) == 1) {
                $defaultdbserver = $server['db_server'][0]['server_id'];
            } else {
                $rnd = rand(0, count($server['db_server']) - 1);
                $defaultdbserver = $server['db_server'][$rnd]['server_id'];
            }
            if (count($server['dns_server']) == 1) {
                $defaultdnsserver = $server['dns_server'][0]['server_id'];
            } else {
                $rnd = rand(0, count($server['dns_server']) - 1);
                $defaultdnsserver = $server['dns_server'][$rnd]['server_id'];
            }
            if (count($server['file_server']) == 1) {
                $defaultfileserver = $server['file_server'][0]['server_id'];
            } else {
                $rnd = rand(0, count($server['file_server']) - 1);
                $defaultfileserver = $server['file_server'][$rnd]['server_id'];
            }
            logModuleCall('ispconfig', 'CreateClient', $server, $server, '', '');
            $ispcparams = array('company_name' => $companyname, 'contact_name' => $fullname, 'customer_no' => $accountid, 'username' => $username, 'password' => $password, 'language' => $defaultlanguage, 'usertheme' => $designtheme, 'street' => $address, 'zip' => $zip, 'city' => $city, 'state' => $state, 'country' => $country, 'telephone' => $phonenumber, 'mobile' => '', 'fax' => '', 'email' => $mail, 'template_master' => $templateid, 'web_php_options' => $globalphp, 'ssh_chroot' => $chrootenable, 'default_mailserver' => $defaultmailserver, 'default_webserver' => $defaultwebserver, 'default_dbserver' => $defaultdbserver, 'default_dnsserver' => $defaultdnsserver, 'locked' => '0', 'created_at' => date('Y-m-d'));
            $reseller_id = 0;
            $client_id = $client->client_add($session_id, $reseller_id, $ispcparams);
            logModuleCall('ispconfig', 'CreateClient', $client_id, $ispcparams, '', '');
            if ($domaintool == 'on') {
                $ispcparams = array('domain' => $domain);
                $domain_id = $client->domains_domain_add($session_id, $client_id, $ispcparams);
                logModuleCall('ispconfig', 'CreateDomainAdd', $domain_id, $ispcparams, '', '');
            }
            if ($dns == 'on') {
                $dns_id = $client->dns_templatezone_add($session_id, $client_id, $dnstemplate, $domain, $zoneip, $nameserver1, $nameserver2, $soaemail);
                logModuleCall('ispconfig', 'CreateDNSZone', $domain, 'DNS Template ' . $dnstemplate, '', '');
            }
            if ($webcreation == 'on') {
                $ispcparams = array('server_id' => $defaultwebserver, 'ip_address' => '*', 'domain' => $domain, 'type' => 'vhost', 'parent_domain_id' => '0', 'vhost_type' => 'name', 'hd_quota' => $webquota, 'traffic_quota' => $webtraffic, 'cgi' => $enablecgi, 'ssi' => $enablessi, 'perl' => $enableperl, 'ruby' => $enableruby, 'python' => $enablepython, 'suexec' => $enablesuexec, 'errordocs' => $enableerrdocs, 'is_subdomainwww' => 1, 'subdomain' => $subdomain, 'php' => $phpmode, 'ruby' => $enableruby, 'redirect_type' => '', 'redirect_path' => '', 'ssl' => $enablessl, 'ssl_state' => '', 'ssl_locality' => '', 'ssl_organisation' => '', 'ssl_organisation_unit' => '', 'ssl_country' => '', 'ssl_domain' => '', 'ssl_request' => '', 'ssl_key' => '', 'ssl_cert' => '', 'ssl_bundle' => '', 'ssl_action' => '', 'stats_password' => $password, 'stats_type' => 'awstats', 'allow_override' => 'All', 'php_open_basedir' => '/', 'php_fpm_use_socket' => 'y', 'pm' => 'dynamic', 'pm_max_children' => '10', 'pm_start_servers' => '2', 'pm_min_spare_servers' => '1', 'pm_max_spare_servers' => '5', 'pm_process_idle_timeout' => '10', 'pm_max_requests' => '0', 'custom_php_ini' => '', 'backup_interval' => '', 'backup_copies' => 1, 'active' => $webactive, 'traffic_quota_lock' => 'n', 'added_date' => date("Y-m-d"), 'added_by' => $soapuser);
                if ($webwriteprotect == 'on') {
                    $readonly = true;
                } else {
                    $readonly = false;
                }
                $website_id = $client->sites_web_domain_add($session_id, $client_id, $ispcparams, $readonly);
                logModuleCall('ispconfig', 'CreateWebDomain', $website_id, $ispcparams, '', '');
                if ($addftpuser == 'on') {
                    $domain_arr = $client->sites_web_domain_get($session_id, $website_id);
                    $ispcparams = array('server_id' => $defaultwebserver, 'parent_domain_id' => $website_id, 'username' => $username, 'password' => $password, 'quota_size' => $webquota, 'active' => 'y', 'uid' => $domain_arr['system_user'], 'gid' => $domain_arr['system_group'], 'dir' => $domain_arr['document_root'] . '/private', 'quota_files' => -1, 'ul_ratio' => -1, 'dl_ratio' => -1, 'ul_bandwidth' => -1, 'dl_bandwidth' => -1);
                    $ftp_id = $client->sites_ftp_user_add($session_id, $client_id, $ispcparams);
                    logModuleCall('ispconfig', 'CreateFtpUser', $ftp_id, $ispcparams, '', '');
                }
                // Add A Record and CNAME Records for website to dns.
                if ($dns == 'on') {
                    $zone_id = $client->dns_zone_get_by_user($session_id, $client_id, $defaultdnsserver);
                    $dns_svr = $client->dns_zone_get($session_id, $zone_id[0]['id']);
                    $a_svr = $client->server_get_all($session_id);
                    // Loop through the array till we find the mail server name
                    while ($arec == '') {
                        $poparr = array_pop($a_svr);
                        if ($poparr['server_id'] == $defaultwebserver) {
                            $arec = $poparr['server_name'];
                        }
                    }
                    $sql = 'SELECT ipaddress FROM tblservers ' . 'WHERE hostname  = "' . $arec . '"';
                    $db_result = mysql_query($sql);
                    $a_ip = mysql_fetch_array($db_result);
                    logModuleCall('ispconfig', 'CreateDNSA', $zone_mx, $a_ip, '', '');
                    $params = array('server_id' => $dns_svr['server_id'], 'zone' => $zone_id[0]['id'], 'name' => $domain . '.', 'type' => 'A', 'data' => $a_ip['ipaddress'], 'aux' => '0', 'ttl' => '3600', 'active' => 'y', 'stamp' => date('Y-m-d H:i:s'), 'serial' => '');
                    $zone_mx = $client->dns_a_add($session_id, $client_id, $params);
                    logModuleCall('ispconfig', 'CreateDNSA', $zone_mx, $params, '', '');
                    // Add cname record
                    $params = array('server_id' => $dns_svr['server_id'], 'zone' => $zone_id[0]['id'], 'name' => 'www', 'type' => 'CNAME', 'data' => $domain . '.', 'aux' => '0', 'ttl' => '3600', 'active' => 'y', 'stamp' => date('Y-m-d H:i:s'), 'serial' => '');
                    $zone_mx = $client->dns_cname_add($session_id, $client_id, $params);
                    logModuleCall('ispconfig', 'CreateDNSCNAME', $zone_mx, $params, '', '');
                }
            }
            if ($addmaildomain == 'on') {
                $ispcparams = array('server_id' => $defaultmailserver, 'domain' => $domain, 'active' => 'y');
                $maildomain_id = $client->mail_domain_add($session_id, $client_id, $ispcparams);
                logModuleCall('ispconfig', 'CreateMailDomain', $maildomain_id, $ispcparams, '', '');
                // Add MX Record to dns.
                if ($dns == 'on') {
                    $zone_id = $client->dns_zone_get_by_user($session_id, $client_id, $defaultdnsserver);
                    $dns_svr = $client->dns_zone_get($session_id, $zone_id[0]['id']);
                    $mx_svr = $client->server_get_all($session_id);
                    // Loop through the array till we find the mail server name
                    while ($mx == '') {
                        $poparr = array_pop($mx_svr);
                        if ($poparr['server_id'] == $defaultmailserver) {
                            $mx = $poparr['server_name'];
                        }
                    }
                    $params = array('server_id' => $dns_svr['server_id'], 'zone' => $zone_id[0]['id'], 'name' => $domain . '.', 'type' => 'mx', 'data' => $mx . '.', 'aux' => '0', 'ttl' => '3600', 'active' => 'y', 'stamp' => date('Y-m-d H:i:s'), 'serial' => '');
                    $zone_mx = $client->dns_mx_add($session_id, $client_id, $params);
                    logModuleCall('ispconfig', 'CreateDNSMX', $zone_mx, $params, '', '');
                }
            }
            if ($client->logout($session_id)) {
            }
            $successful = 1;
        } catch (SoapFault $e) {
            $error = 'SOAP Error: ' . $e->getMessage();
            $successful = 0;
            logModuleCall('ispconfig', 'Create Failed', $e->getMessage(), $params, '', '');
        }
        if ($successful == 1) {
            $result = "success";
        } else {
            $result = $error;
        }
    } else {
        /*
         * No username or password set.
         */
        $result = 'Username or Password is Blank or Not Set';
    }
    return $result;
}
Example #5
0
 }
 /*
  * client_add
  * 
  * db : dbispconfig -> client
  * 
  * 
  */
 $reseller_id = 0;
 // this id has to be 0 if the client shall not be assigned to admin or if the client is a reseller
 $paramsClientAdd = array('company_name' => $clientCompany, 'contact_name' => $clientName, 'customer_no' => '', 'vat_id' => '', 'street' => '', 'zip' => '', 'city' => $clientCity, 'state' => '', 'country' => $clientCountry, 'telephone' => $clientPhone, 'mobile' => $clientPhone, 'fax' => '', 'email' => $clientEmail, 'internet' => '', 'icq' => '', 'notes' => '', 'default_mailserver' => 1, 'limit_maildomain' => 1, 'limit_mailbox' => 5, 'limit_mailalias' => 1, 'limit_mailaliasdomain' => 1, 'limit_mailforward' => 1, 'limit_mailcatchall' => 1, 'limit_mailrouting' => 0, 'limit_mailfilter' => 5, 'limit_fetchmail' => -1, 'limit_mailquota' => 500, 'limit_spamfilter_wblist' => 0, 'limit_spamfilter_user' => 0, 'limit_spamfilter_policy' => 1, 'default_webserver' => 1, 'limit_web_ip' => '', 'limit_web_domain' => 1, 'limit_web_quota' => 1000, 'web_php_options' => 'no,fast-cgi,cgi,mod,suphp,php-fpm', 'limit_web_subdomain' => 1, 'limit_web_aliasdomain' => 1, 'limit_ftp_user' => 2, 'limit_shell_user' => 0, 'ssh_chroot' => 'no,jailkit,ssh-chroot', 'limit_webdav_user' => 0, 'default_dnsserver' => 1, 'limit_dns_zone' => 1, 'limit_dns_slave_zone' => 0, 'limit_dns_record' => 0, 'default_dbserver' => 1, 'limit_database' => 1, 'limit_cron' => 0, 'limit_cron_type' => 'url', 'limit_cron_frequency' => 5, 'limit_traffic_quota' => 1000, 'limit_client' => 0, 'parent_client_id' => 0, 'username' => $clientUsername, 'password' => $clientPassword, 'language' => 'en', 'usertheme' => 'default', 'template_master' => 0, 'template_additional' => '', 'added_date' => $today);
 if ($_POST["clientadd"] == "no") {
     // admin becomes the client for new domain
     $client_id = 3;
 } else {
     $clientID = $client->client_add($session_id, $reseller_id, $paramsClientAdd);
     // attributing the client id to the newly created
     $client_id = $clientID;
 }
 /* sites_web_domain_add 
  * 
  * db : dbispconfig -> web_domain 
 
 the following are filled like below and not as defined by apache ; look into templates 
 pm_max_children 1
 pm_start_servers 1
 pm_min_spare_Servers 1
 pm_max_spare_servers 1
 pm_process_idle_timeout 1
 pm_max_Requests 10
 
Example #6
0
<?php

require 'soap_config.php';
$client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1));
try {
    if ($session_id = $client->login($username, $password)) {
        echo 'Logged successfull. Session ID:' . $session_id . '<br />';
    }
    //* Set the function parameters.
    $reseller_id = 0;
    // this id has to be 0 if the client shall not be assigned to admin or if the client is a reseller
    $params = array('company_name' => 'awesomecompany', 'contact_name' => 'name', 'customer_no' => '1', 'vat_id' => '1', 'street' => 'fleetstreet', 'zip' => '21337', 'city' => 'london', 'state' => 'bavaria', 'country' => 'GB', 'telephone' => '123456789', 'mobile' => '987654321', 'fax' => '546718293', 'email' => '*****@*****.**', 'internet' => '', 'icq' => '111111111', 'notes' => 'awesome', 'default_mailserver' => 1, 'limit_maildomain' => -1, 'limit_mailbox' => -1, 'limit_mailalias' => -1, 'limit_mailaliasdomain' => -1, 'limit_mailforward' => -1, 'limit_mailcatchall' => -1, 'limit_mailrouting' => 0, 'limit_mailfilter' => -1, 'limit_fetchmail' => -1, 'limit_mailquota' => -1, 'limit_spamfilter_wblist' => 0, 'limit_spamfilter_user' => 0, 'limit_spamfilter_policy' => 1, 'default_webserver' => 1, 'limit_web_ip' => '', 'limit_web_domain' => -1, 'limit_web_quota' => -1, 'web_php_options' => 'no,fast-cgi,cgi,mod,suphp', 'limit_web_subdomain' => -1, 'limit_web_aliasdomain' => -1, 'limit_ftp_user' => -1, 'limit_shell_user' => 0, 'ssh_chroot' => 'no,jailkit,ssh-chroot', 'limit_webdav_user' => 0, 'default_dnsserver' => 1, 'limit_dns_zone' => -1, 'limit_dns_slave_zone' => -1, 'limit_dns_record' => -1, 'default_dbserver' => 1, 'limit_database' => -1, 'limit_cron' => 0, 'limit_cron_type' => 'url', 'limit_cron_frequency' => 5, 'limit_traffic_quota' => -1, 'limit_client' => 0, 'parent_client_id' => 0, 'username' => 'guy3', 'password' => 'brush', 'language' => 'en', 'usertheme' => 'default', 'template_master' => 0, 'template_additional' => '', 'created_at' => 0);
    $affected_rows = $client->client_add($session_id, $reseller_id, $params);
    echo "Client: " . $affected_rows . "<br>";
    if ($client->logout($session_id)) {
        echo 'Logged out.<br />';
    }
} catch (SoapFault $e) {
    echo $client->__getLastResponse();
    die('SOAP Error: ' . $e->getMessage());
}