Вход Регистрация
Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootinc/regru.inc.php
Строк: 421
<?

class REGRU
{
    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,$fail_if_no_money,$no_bill_notify,$ns0,$ns1,$ns2,$ns3,$org,$org_r,$code,$kpp,$country,$address_r,$p_addr,$phone,$fax,$e_mail)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

        
//connect using prpoer xml api address
        
$result $this->connect("action=domain_create&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&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,$fail_if_no_money,$no_bill_notify,$ns0,$ns1,$ns2,$ns3,$person,$private_person_flag,$person_r,$passport,$birth_date,$country,$p_addr,$phone,$fax,$e_mail,$code)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

        
//connect using prpoer xml api address
        
$result $this->connect("action=domain_create&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&person=$person&private_person_flag=$private_person_flag&person_r=$person_r&passport=$passport&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 COM/NET/etc domain
     * Output: true on success, false on fail
     */                                                                                                    
    
public function regEtcDomain($domain,$period,$fail_if_no_money,$no_bill_notify,$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)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

        
//connect using prpoer xml api address
        
$result $this->connect("action=domain_create&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&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&b_company=$o_company&b_first_name=$o_first_name&b_last_name=$o_last_name&b_email=$o_email&b_phone=".urlencode($o_phone)."&b_fax=".urlencode($o_fax)."&b_addr=$o_addr&b_city=$o_city&b_state=$o_state&b_postcode=$o_postcode&b_country_code=$o_country_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;
        }
    }

    
/*
     * renew domain
     * Output: true on success, false on fail
     */
    
public function renewDomain($domain$period$fail_if_no_money$no_bill_notify)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

        
//connect using prpoer xml api address
        
$result $this->connect("action=domain_renew&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&");

        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)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

        
//connect using prpoer xml api address
        
$result $this->connect("action=domain_get_nss&username=".$this->user."&password=".$this->password."&domain_name=$domain&showip=0&");

        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)) {
            
$result=preg_replace("/Success: /ui","",$result);
            
$result=mb_split(", ",$result);

            return 
$result;
            break;
        }
    }


    
/*
     * update NS for domain
     * Output: True on success, false on fail
     */
    
public function updateNS($domain,$ns0,$ns1,$ns2,$ns3)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

        
//connect using prpoer xml api address
        
$result $this->connect("action=domain_update_nss&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;
        }
    }

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