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

class CNIC
{
    public 
$url null;
    public 
$user null;
    public 
$password null;
    public 
$registrar null;
    public 
$error null;

    public function 
init($url,$user,$password,$registrar)
    {
        
$this->url $url;
        
$this->user $user;
        
$this->password $password;
        
$this->registrar $registrar;
    }

    public function 
createHandle($name,$company,$street,$city,$sp,$postcode,$country,$phone,$fax,$email,$visible) {

        
$query = new CNic_Toolkit(
            
'create_handle',        // the command
            
1,                // whether or not to use SSL (deprecated but required, SSL is enforced)
            
$this->user,            // your registrar handle
            
$this->password            // your password
        
);

        
$handle = array(
            
name        => $name,
            
company     => $company,
            
street1     => $street,
            
street2        => '',
            
city        => $city,
            
sp        => $sp,
            
postcode    => $postcode,
            
country     => $country,
            
phone         => $phone,
            
fax        => $fax,
            
email         => $email,
        );

        
$query->set('handle'$handle);

        
// hide the handle from whois records:
        
$query->set('visible'$visible);

        
$response $query->execute();

        if (
$response->is_success()) {
            return 
$response->handle();
        } else {
            
$this->error $response->error();
            return 
false;
        }
    }

    public function 
registerDomain($domain,$period,$handle,$ns1,$ns2,$ns3,$ns4,$ns1ip,$ns2ip,$ns3ip,$ns4ip) {
        
$query = new CNic_Toolkit(
            
'register',            // the command
            
$domain,            // the domain name
            
1,                // whether or not to use SSL (deprecated but required, SSL is enforced)
            
$this->user,            // your registrar handle
            
$this->password            // your password
        
);

        
$query->set('registrant'$this->registrar);
        
$query->set('chandle'$handle);
        
$query->set('thandle''chandle');
        
$query->set('period'$period);

        
$dns = array();
        if (
$ns1ip) { $dns[$ns1] = $ns1ip; } else { $dns[] = $ns1; }
        if (
$ns2ip) { $dns[$ns2] = $ns2ip; } else { $dns[] = $ns2; }
        if (
$ns3) { if ($ns3ip) { $dns[$ns3] = $ns3ip; } else { $dns[] = $ns3; } }
        if (
$ns4) { if ($ns4ip) { $dns[$ns4] = $ns4ip; } else { $dns[] = $ns4; } }

        
$query->set('dns'$dns);

        
$response $query->execute();

        if (
$response->is_success()) {
            return 
true;
        } else {
            
$this->error $response->error();
            return 
false;
        }
    }

    public function 
renewDomain($domain,$period) {
        
$query = new CNic_Toolkit(
            
'issue_renewals',        // the command
            
1,                // whether or not to use SSL (deprecated but required, SSL is enforced)
            
$this->user,            // your registrar handle
            
$this->password            // your password
        
);

        
$domains = array($domain);

        
$query->set('domains'$domains);
        
$query->set('period'$period);
        
$query->set('immediate'1);

        
$response $query->execute();

        if (
$response->is_success()) {
            return 
true;
        } else {
            
$this->error $response->error();
            return 
false;
        }
    }

    public function 
getNS($domain) {
        
// create a request object:
        
$query = new CNic_Toolkit('whois'$domain);

        
// execute the query to return a response object:
        
$response $query->execute();

        if (
$response->is_success()) {
            return 
$response->response('dns');
        } else {
            
$this->error $response->error();
            return 
false;
        }
    }

    public function 
updateNS($domain,$ns1,$ns2,$ns3,$ns4,$ns1ip,$ns2ip,$ns3ip,$ns4ip) {
        
$query = new CNic_Toolkit(
            
'modify',            // the command
            
$domain,            // the domain name
            
1,                // whether or not to use SSL (deprecated but required, SSL is enforced)
            
$this->user,            // your registrar handle
            
$this->password            // your password
        
);

        
$dns = array();
        if (
$ns1ip) { $dns[$ns1] = $ns1ip; } else { $dns[] = $ns1; }
        if (
$ns2ip) { $dns[$ns2] = $ns2ip; } else { $dns[] = $ns2; }
        if (
$ns3) { if ($ns3ip) { $dns[$ns3] = $ns3ip; } else { $dns[] = $ns3; } }
        if (
$ns4) { if ($ns4ip) { $dns[$ns4] = $ns4ip; } else { $dns[] = $ns4; } }

        
$query->set('dns', array(
            
'drop'    => 'all',
            
'add'    => $dns,
        ));

        
$response $query->execute();

        if (
$response->is_success()) {
            return 
true;
        } else {
            
$this->error $response->error();
            return 
false;
        }
    }

    public function 
updateHandle($handle,$name,$company,$street,$city,$sp,$postcode,$country,$phone,$fax,$email,$visible) {
        
$query = new CNic_Toolkit(
            
'modify_handle',        // the command
            
1,                // whether or not to use SSL (deprecated but required, SSL is enforced)
            
$this->user,            // your registrar handle
            
$this->password            // your password
        
);

        
$query->set('handle',    $handle);
        
$query->set('name',    $name);
        
$query->set('company',    $company);
        
$query->set('street1',    $street);
        
$query->set('street2',    '');
        
$query->set('city',    $city);
        
$query->set('sp',    $oblast);
        
$query->set('postcode',    $postcode);
        
$query->set('country',    $country);
        
$query->set('phone',    $phone);
        
$query->set('fax',    $fax);
        
$query->set('email',    $email);
        
$query->set('visible',    $visible);

        
$response $query->execute();

        if (
$response->is_success()) {
            return 
true;
        } else {
            
$this->error $response->error();
            return 
false;
        }
    }
}
?>
Онлайн: 1
Реклама