Вход Регистрация
Файл: billing/_rootinc/webnames.inc.php
Строк: 483
<?

class WEBNAMES
{
    public 
$controller true;
    public 
$url=null;
    public 
$user=null;
    public 
$password null;
    public 
$errors=array();
    public 
$fp=null;

    
/*
     * initialization
     */
    
public function startup(&$controller)
    {
        
$this->controller =& $controller;
    }

    
/*
     * initialization
     */
    
public function init($url,$user,$password)
    {
        
$this->url=$url;
        
$this->user=$user;
        
$this->password=$password;
    }

    
/*
     * connect to the xml api
     * Output: true on success, false on fail
     */
    
public function connect($api_path)
    {
        
$api_path=iconv("utf-8""windows-1251"htmlDecode($api_path));

        
$this->fp curl_init(); 
        
curl_setopt($this->fpCURLOPT_URL$this->url);
        
curl_setopt($this->fpCURL_HTTP_VERSION_1_01);
        
curl_setopt($this->fpCURLOPT_POST1);
        
curl_setopt($this->fpCURLOPT_POSTFIELDS$api_path);
        
curl_setopt($this->fpCURLOPT_SSL_VERIFYPEER0);
        
curl_setopt($this->fpCURLOPT_SSL_VERIFYHOST0);
        
curl_setopt($this->fpCURLOPT_RETURNTRANSFER,1);
        
curl_setopt($this->fpCURLOPT_TIMEOUT120);

        
$result curl_exec($this->fp);

        
$result=iconv("windows-1251""utf-8"$result);

        return 
$result;
    }

    
/*
     * Close the socket
     */
    
public function disconnect()
    {
        
curl_close($this->fp);  
    }

    
/*
     * register RU/SU domain for Organization
     * Output: true on success, false on fail
     */
    
public function regRuDomainOrg($domain,$period,$ns0,$ns1,$ns2,$ns3,$org,$org_r,$code,$kpp,$country,$address_r,$p_addr,$phone,$fax,$e_mail)
    {
        
//connect using prpoer xml api address
        
$result $this->connect("thisPage=pispRegistration&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&org=$org&org_r=$org_r&code=$code&kpp=$kpp&country=$country&address_r=$address_r&p_addr=$p_addr&phone=".urlencode($phone)."&fax=".urlencode($fax)."&e_mail=$e_mail");

        if(
$result=='')
        {
            
$this->errors[]='No output.';
            return 
false;
        }
        
//disconnect
        
$this->disconnect();

        if (
preg_match("/Error:/ui",$result)) {
            
$this->errors[] = "$result";
            return 
false;
            break;
        } else if (
preg_match("/Success:/ui",$result)) {
            return 
true;
            break;
        }
    }

    
/*
     * register RU/SU domain for Person
     * Output: true on success, false on fail
     */
    
public function regRuDomainPerson($domain,$period,$ns0,$ns1,$ns2,$ns3,$person,$private_person,$person_r,$passport,$birth_date,$country,$p_addr,$phone,$fax,$e_mail,$code)
    {
        
//connect using prpoer xml api address
        
$result $this->connect("thisPage=pispRegistration&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&person=$person&private_person=$private_person&person_r=$person_r&passport=$passport&residence=$p_addr&birth_date=$birth_date&country=$country&p_addr=$p_addr&phone=".urlencode($phone)."&fax=".urlencode($fax)."&e_mail=$e_mail&code=$code&");

        if(
$result=='')
        {
            
$this->errors[]='No output.';
            return 
false;
        }
        
//disconnect
        
$this->disconnect();

        if (
preg_match("/Error:/ui",$result)) {
            
$this->errors[] = "$result";
            return 
false;
            break;
        } else if (
preg_match("/Success:/ui",$result)) {
            return 
true;
            break;
        }
    }

    
/*
     * register UZ/TJ domain
     * Output: true on success, false on fail
     */
    
public function regKzUzTjDomain($domain,$period,$ns0,$ns1,$ns2,$ns3,$o_name_ru,$o_name_en,$nick,$o_email,$o_phone,$o_fax,$o_addr_ru,$o_addr_en,$o_city_ru,$o_city_en,$o_state_ru,$o_state_en,$o_postcode,$o_country_code,$o_company_ru="",$o_company_en="",$o_code="",$o_bank="",$o_bank_account="",$o_mfo="",$o_okonh="")
    {
        
$xml "thisPage=pispRegistration&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&o_name_ru=$o_name_ru&o_name_en=$o_name_en&o_email=$o_email&o_phone=".urlencode($o_phone)."&o_fax=".urlencode($o_fax)."&o_addr_ru=$o_addr_ru&o_addr_en=$o_addr_en&o_city_ru=$o_city_ru&o_city_en=$o_city_en&o_state_ru=$o_state_ru&o_state_en=$o_state_en&o_postcode=$o_postcode&o_country_code=$o_country_code";
        if (
$o_company_ru and $o_company_en) { $xml $xml."&o_company_ru=$o_company_ru&o_company_en=$o_company_en&o_code=$o_code&o_bank=$o_bank&o_bank_account=$o_bank_account&o_mfo=$o_mfo&o_okonh=$o_okonh"; }

        
$xml $xml."&a_name_ru=$o_name_ru&a_name_en=$o_name_en&a_nick=$nick&a_email=$o_email&a_phone=".urlencode($o_phone)."&a_fax=".urlencode($o_fax)."&a_addr_ru=$o_addr_ru&a_addr_en=$o_addr_en&a_city_ru=$o_city_ru&a_city_en=$o_city_en&a_state_ru=$o_state_ru&a_state_en=$o_state_en&a_postcode=$o_postcode&a_country_code=$o_country_code";
        if (
$o_company_ru and $o_company_en) { $xml $xml."&a_company_ru=$o_company_ru&a_company_en=$o_company_en"; }

        
$xml $xml."&t_name_ru=$o_name_ru&t_name_en=$o_name_en&t_nick=$nick&t_email=$o_email&t_phone=".urlencode($o_phone)."&t_fax=".urlencode($o_fax)."&t_addr_ru=$o_addr_ru&t_addr_en=$o_addr_en&t_city_ru=$o_city_ru&t_city_en=$o_city_en&t_state_ru=$o_state_ru&t_state_en=$o_state_en&t_postcode=$o_postcode&t_country_code=$o_country_code";
        if (
$o_company_ru and $o_company_en) { $xml $xml."&t_company_ru=$o_company_ru&t_company_en=$o_company_en"; }

        
$xml $xml."&b_name_ru=$o_name_ru&b_name_en=$o_name_en&b_nick=$nick&b_email=$o_email&b_phone=".urlencode($o_phone)."&b_fax=".urlencode($o_fax)."&b_addr_ru=$o_addr_ru&b_addr_en=$o_addr_en&b_city_ru=$o_city_ru&b_city_en=$o_city_en&b_state_ru=$o_state_ru&b_state_en=$o_state_en&b_postcode=$o_postcode&b_country_code=$o_country_code";
        if (
$o_company_ru and $o_company_en) { $xml $xml."&b_company_ru=$o_company_ru&b_company_en=$o_company_en"; }

        
//connect using prpoer xml api address
        
$result $this->connect($xml);

        if(
$result=='')
        {
            
$this->errors[]='No output.';
            return 
false;
        }
        
//disconnect
        
$this->disconnect();

        if (
preg_match("/Error:/ui",$result)) {
            
$this->errors[] = "$result";
            return 
false;
            break;
        } else if (
preg_match("/Success:/ui",$result)) {
            return 
true;
            break;
        }
    }

    
/*
     * register other domains
     * Output: true on success, false on fail
     */
    
public function regOtherDomain($domain,$period,$ns0,$ns1,$ns2,$ns3,$o_company,$o_first_name,$o_last_name,$o_email,$o_phone,$o_fax,$o_addr,$o_city,$o_state,$o_postcode,$o_country_code,$default_ced)
    {
        if (
$default_ced) {$ced "default_ced=on";} else {$ced="";}

        
//connect using prpoer xml api address
        
$result $this->connect("thisPage=pispRegistration&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&o_company=$o_company&o_first_name=$o_first_name&o_last_name=$o_last_name&o_email=$o_email&o_phone=".urlencode($o_phone)."&o_fax=".urlencode($o_fax)."&o_addr=$o_addr&o_city=$o_city&o_state=$o_state&o_postcode=$o_postcode&o_country_code=$o_country_code&a_company=$o_company&a_first_name=$o_first_name&a_last_name=$o_last_name&a_email=$o_email&a_phone=".urlencode($o_phone)."&a_fax=".urlencode($o_fax)."&a_addr=$o_addr&a_city=$o_city&a_state=$o_state&a_postcode=$o_postcode&a_country_code=$o_country_code&t_company=$o_company&t_first_name=$o_first_name&t_last_name=$o_last_name&t_email=$o_email&t_phone=".urlencode($o_phone)."&t_fax=".urlencode($o_fax)."&t_addr=$o_addr&t_city=$o_city&t_state=$o_state&t_postcode=$o_postcode&t_country_code=$o_country_code&$ced");

        if(
$result=='')
        {
            
$this->errors[]='No output.';
            return 
false;
        }
        
//disconnect
        
$this->disconnect();

        if (
preg_match("/Error:/ui",$result)) {
            
$this->errors[] = "$result";
            return 
false;
            break;
        } else if (
preg_match("/Success:/ui",$result)) {
            return 
true;
            break;
        }
    }

    
/*
     * renew domain
     * Output: true on success, false on fail
     */
    
public function renewDomain($domain$period)
    {
        
//connect using prpoer xml api address
        
$result $this->connect("thisPage=pispRenewDomain&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&");

        if(
$result=='')
        {
            
$this->errors[]='No output.';
            return 
false;
        }
        
//disconnect
        
$this->disconnect();

        if (
preg_match("/Error:/ui",$result)) {
            
$this->errors[] = "$result";
            return 
false;
            break;
        } else if (
preg_match("/Success:/ui",$result)) {
            return 
true;
            break;
        }
    }

    
/*
     * get NS for domain
     * Output: Array on success, false on fail
     */
    
public function getNS($domain)
    {
        
//connect using prpoer xml api address

        
$result $this->connect("thisPage=pispWhois&username=".$this->user."&password=".$this->password."&domain_name=$domain&");

        if(
$result=='')
        {
            
$this->errors[]='No output.';
            return 
false;
        }
        
//disconnect
        
$this->disconnect();                                                 

        if (
preg_match("/Error:/ui",$result)) {
            
$this->errors[] = "$result";
            return 
false;
            break;
        } else if (
preg_match("/nserver/ui",$result)) {
            
$result1 mb_split("n"$result);
            while (list(
$index,$res) = each($result1)) {
                if (
preg_match("/nserver/ui",$res)) {
                    
preg_match("/nserver:s+(.*)/iu",$res,$arr);
                    
$resultarray[]=$arr[1];
                } else if (
preg_match("/Name Server/ui",$res)) {
                    
preg_match("/Name Server:s+(.*)/iu",$res,$arr);
                    
$resultarray[]=$arr[1];
                }
            }
            return 
$resultarray;
            break;
        }
    }


    
/*
     * update NS for domain
     * Output: True on success, false on fail
     */
    
public function updateNS($domain,$ns0,$ns1,$ns2,$ns3)
    {
        
//connect using prpoer xml api address
        
$result $this->connect("thisPage=pispRedelegation&username=".$this->user."&password=".$this->password."&domain_name=$domain&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&");

        if(
$result=='')
        {
            
$this->errors[]='No output.';
            return 
false;
        }
        
//disconnect
        
$this->disconnect();                                                 

        if (
preg_match("/Error:/ui",$result)) {
            
$this->errors[] = "$result";
            return 
false;
            break;
        } else if (
preg_match("/Success:/ui",$result)) {
            return 
true;
            break;
        }
    }

}
?>
Онлайн: 1
Реклама