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

$nicruService
["ru"] = "domain_ru";
$nicruService["su"] = "domain_su";
$nicruService["net"] = "domain_rrp";
$nicruService["com"] = "domain_rrp";
$nicruService["org"] = "domain_rrp";
$nicruService["biz"] = "domain_rrp";
$nicruService["info"] = "domain_rrp";
$nicruService["cc"] = "domain_epp_cc";
$nicruService["tv"] = "domain_epp_tv";
$nicruService["me"] = "domain_epp_me";

class 
NICRU
{
    public 
$controller true;
    public 
$url null;
    public 
$user null;
    public 
$password null;
    public 
$error null;

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

    public function 
init($url,$user,$password)
    {
        
$this->url=$url;
        
$this->user=$user."/NIC-REG/ADM";
        
$this->password=$password;
    }

    public function 
send($request)
    {
        
$request iconv("utf-8","koi8-r",htmlDecode("SimpleRequest=".$request));

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

        
$result curl_exec($fp);

        
curl_close($fp);  

        
$result iconv("koi8-r","utf-8",$result);

        return 
$this->parseResult($result);
    }

    public function 
parseResult($result)
    {
        
$results mb_split("n",$result);

        
$resArray null;
        
$nserver 0;
        while (list(
$index,$res) = each($results)) {
            
$res=trim($res);

            if (
preg_match("/^State:s+(d{3})s+(.*)$/ui",$res,$arr)) {
                
$resArray["state:code"] = $arr[1];
                
$resArray["state:msg"] = $arr[2];
                if (
$arr[1] == "402") {
                    
$tmp mb_split("[errors]",$result);
                    
$tmp[1]=preg_replace("/n/ui","",$tmp[1]);
                    
$resArray["state:error"] = "(".$tmp[1].")";
                }
            } else if (
preg_match("/^([^:]+):s*([^:]+)$/ui",$res,$arr)) {
                
$newIndex $arr[1];
                if (
$newIndex == "nserver") {$nserver++; $newIndex $newIndex.$nserver; }
                
$newValue $arr[2];
                
$resArray[$newIndex] = $newValue;
            }
        }
        return 
$resArray;
    }

    public function 
regAnketaPerson($pw,$tech_pw,$person,$person_r,$country,$passport,$birth_date,$p_addr,$phone,$fax,$email,$mnt)
    {

$req "lang:ru
request:contract
operation:create
login:"
.$this->user."
password:"
.$this->password."
request-id:"
.microtime()."

[contract]
contract-type:PRS
password:"
.$pw."
tech-password:"
.$tech_pw."
person:"
.$person."
person-r:"
.$person_r."
country:"
.strtoupper($country)."
currency-id:RUR
passport:"
.$passport."
birth-date:"
.$birth_date."
p-addr:"
.$p_addr."
phone:"
.urlencode($phone)."
fax-no:"
.urlencode($fax)."
e-mail:"
.$email."
mnt-nfy:"
.$mnt."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
$result["login"];
        } else {
            
$this->error "regAnketaPerson: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }

    public function 
regAnketaOrg($pw,$tech_pw,$org,$org_r,$code,$kpp,$country,$address_r,$p_addr,$d_addr,$phone,$fax,$email,$mnt)
    {
$req "lang:ru
request:contract
operation:create
login:"
.$this->user."
password:"
.$this->password."
request-id:"
.microtime()."

[contract]
contract-type:ORG
password:"
.$pw."
tech-password:"
.$tech_pw."
org:"
.$org."
org-r:"
.$org_r."
code:"
.$code."
kpp:"
.$kpp."
country:"
.strtoupper($country)."
currency-id:RUR
address-r:"
.$address_r."
p-addr:"
.$p_addr."
d-addr:"
.$d_addr."
phone:"
.urlencode($phone)."
fax-no:"
.urlencode($fax)."
e-mail:"
.$email."
mnt-nfy:"
.$mnt."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
$result["login"];
        } else {
            
$this->error "regAnketaOrg: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }

    public function 
regRuDomain($anketaId,$service,$domain,$ns1,$ns2,$ns3,$ns4,$descr,$private_person,$email,$phone,$fax)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }


$req "lang:ru
request:order
operation:create
login:"
.$this->user."
password:"
.$this->password."
subject-contract:"
.$anketaId."
request-id:"
.microtime()."

[order-item]
service:"
.$service."
template:client_ru
action:new
domain:"
.$domain."
descr:"
.$descr."
private-person:"
.$private_person."
e-mail:"
.$email."
phone:"
.urlencode($phone)."
fax-no:"
.urlencode($fax)."
nserver:"
.$ns1."
nserver:"
.$ns2."
nserver:"
.$ns3."
nserver:"
.$ns4."
type:CORPORATE
"
;
        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
$result["order_id"];
        } else {
            
$this->error "regRuDomain: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }

    public function 
regContact($anketaId,$org,$name,$country,$region,$city,$street,$zip,$phone,$fax,$email)
    {
$req "login:".$this->user."
password:"
.$this->password."
subject-contract:"
.$anketaId."
request:contact
operation:create
lang:ru 
request-id:"
.microtime()."

[contact]
status:registrant
org:"
.$org."
name:"
.$name."
country:"
.strtoupper($country)."
region:"
.$region."
city:"
.$city."
street:"
.$street."
zipcode:"
.$zip."
phone:"
.urlencode($phone)."
fax:"
.urlencode($fax)."
email:"
.$email."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
$result["nic-hdl"];
        } else {
            
$this->error "regContact: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }

    public function 
regDomain($anketaId,$contactId,$service,$domain,$period,$ns1,$ns2,$ns3,$ns4)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

$req "login:".$this->user."
password:"
.$this->password."
subject-contract:"
.$anketaId."
request:order
operation:create
lang:ru
request-id:"
.microtime()."

[order-item]
action:new
service:"
.$service."
period:"
.$period."
template:client_rrp 
domain:"
.$domain."
nserver:"
.$ns1."
nserver:"
.$ns2."
nserver:"
.$ns3."
nserver:"
.$ns4."
admin-c:"
.$contactId."
bill-c:"
.$contactId."
tech-c:"
.$contactId."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
$result["order_id"];
        } else {
            
$this->error "regDomain: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }

    }

    public function 
renewDomain($anketaId,$service,$domain,$period)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

$req "lang:ru
request:order
operation:create
login:"
.$this->user."
password:"
.$this->password."
subject-contract:"
.$anketaId."
request-id:"
.microtime()."

[order-item]
action:prolong
template:prolong
service:"
.$service."
domain:"
.$domain."
prolong:"
.$period."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
true;
        } else {
            
$this->error "renewDomain: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }

    public function 
getNS($orderId)
    {
$req "lang: ru
login:"
.$this->user."
password:"
.$this->password."
request:order
operation:get
request-id:"
.microtime()."

[order]
order_id:"
.$orderId."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {

            if (
$result["nserver1"]) {$resultarray[]=$result["nserver1"];}
            if (
$result["nserver2"]) {$resultarray[]=$result["nserver2"];}
            if (
$result["nserver3"]) {$resultarray[]=$result["nserver3"];}
            if (
$result["nserver4"]) {$resultarray[]=$result["nserver4"];}

            return 
$resultarray;
        } else {
            
$this->error "getNS: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }

    public function 
updateNS($anketaId,$contactId,$service,$domain,$ns1,$ns2,$ns3,$ns4)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

$req "login:".$this->user."
password:"
.$this->password."
subject-contract:"
.$anketaId."
request:order
operation:create
lang:ru
request-id:"
.microtime().";

[order-item]
action:update
service:"
.$service."
template:client_rrp
domain:"
.$domain."
nserver:"
.$ns1."
nserver:"
.$ns2."
nserver:"
.$ns3."
nserver:"
.$ns4."
admin-c:"
.$contactId."
bill-c:"
.$contactId."
tech-c:"
.$contactId."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
$result["order_id"];
        } else {
            
$this->error "updateNS: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }

    public function 
updateRuNS($anketaId,$service,$domain,$descr,$private_person,$ns1,$ns2,$ns3,$ns4)
    {
        if (
preg_match("/[а-яёЁ]/ui",$domain)) {
            
$idna = new idna_convert();
            
$domain $idna->encode($domain);
        }

$req "lang:ru
request:order
operation:create
login:"
.$this->user."
password:"
.$this->password."
subject-contract:"
.$anketaId."
request-id:"
.microtime()."

[order-item]
service:"
.$service."
template:client_ru
action:update
domain:"
.$domain."
descr:"
.$descr."
private-person:"
.$private_person."
e-mail:"
.$email."
phone:"
.urlencode($phone)."
fax-no:"
.urlencode($fax)."
nserver:"
.$ns1."
nserver:"
.$ns2."
nserver:"
.$ns3."
nserver:"
.$ns4."
"
;

        
$result $this->send($req);

        if (
$result["state:code"] == "200") {
            return 
$result["order_id"];
        } else {
            
$this->error "updateRuNS: ".$result["state:code"]." ".$result["state:msg"]." ".$result["state:error"];
            return 
false;
        }
    }
}
?>
Онлайн: 3
Реклама