Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.4.0
- * @ Author : DeZender
- * @ Release on : 30.03.2012
- * @ Official site : http://DeZender.Net
- *
- */
- class molddata_epp_client {
- var $socket = null;
- var $clTRID = 'undefined';
- var $isLogined = false;
- function molddata_epp_client($host = '', $port = 700, $ssl = false, $timeout = 1) {
- if ($host) {
- $this->connect( $host, $port, $ssl, $timeout );
- }
- }
- function connect($host, $port = 700, $ssl = false, $timeout = 1) {
- $config = molddata_getConfigArray( );
- if (!in_array( $host, preg_split( '/[\s\,]+/', $config['EPPServer']['Options'] ) )) {
- throw new exception( 'Cannot connect to server \'' . $host . '\': Unknown server' );
- }
- $this->clTRID = str_replace( '.', '', round( microtime( 1 ), 3 ) );
- if (is_array( $ssl )) {
- $opts = array( 'ssl' => array( 'verify_peer' => $ssl['verify_peer'], 'cafile' => 'G:\compilation_php\BUILDS\De-IonCube_PHP_5.3\01-encoded' . '/CAfiles/' . $ssl['cafile'], 'local_cert' => 'G:\compilation_php\BUILDS\De-IonCube_PHP_5.3\01-encoded' . '/certs/' . $ssl['local_rest'], 'passphrase' => $ssl['passphrase'] ) );
- $context = stream_context_create( $opts );
- $this->socket = stream_socket_client( ( 'tls://' . $host . ':' ) . $port, $errno, $errmsg, $timeout, STREAM_CLIENT_CONNECT, $context );
- } else {
- $this->socket = fsockopen( 'tcp://' . $host, $port, $errno, $errmsg, $timeout );
- }
- if (!$this->socket) {
- throw new exception( 'Cannot connect to server \'' . $host . '\': ' . $errmsg );
- }
- return $this->read( );
- }
- function login($login, $pwd) {
- $from = $to = array( );
- $from[] = '/{login}/';
- $to[] = htmlspecialchars( $login );
- $from[] = '/{pwd}/';
- $to[] = htmlspecialchars( $pwd );
- $from[] = '/{clTRID}/';
- $to[] = htmlspecialchars( $this->clTRID );
- $xml = preg_replace( $from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
- <command>
- <login>
- <clID>{login}</clID>
- <pw>{pwd}</pw>
- <options>
- <version>1.0</version>
- <lang>en</lang>
- </options>
- <svcs>
- <objURI>urn:ietf:params:xml:ns:obj1</objURI>
- <objURI>urn:ietf:params:xml:ns:obj2</objURI>
- <objURI>urn:ietf:params:xml:ns:obj3</objURI>
- <svcExtension>
- <extURI>http://custom/obj1ext-1.0</extURI>
- </svcExtension>
- </svcs>
- </login>
- <clTRID>{clTRID}</clTRID>
- </command>
- </epp>' );
- $r = $this->write( $xml );
- $this->isLogined = true;
- return true;
- }
- function logout() {
- if (!$this->isLogined) {
- return true;
- }
- $from = $to = array( );
- $from[] = '/{clTRID}/';
- $to[] = htmlspecialchars( $this->clTRID );
- $xml = preg_replace( $from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
- <command>
- <logout/>
- <clTRID>{clTRID}</clTRID>
- </command>
- </epp>' );
- $r = $this->write( $xml );
- $this->isLogined = false;
- return true;
- }
- function read() {
- _molddata_log( '-------read-this------------', $this );
- if (feof( $this->socket )) {
- throw new esxception( 'Connection appears to have closed.' );
- }
- $hdr = @fread( $this->socket, 4 );
- if (empty( $$hdr )) {
- throw new exception( 'Error reading from server: ' . $php_errormsg );
- return null;
- }
- $unpacked = unpack( 'N', $hdr );
- $xml = fread( $this->socket, $unpacked[1] - 4 );
- $xml = preg_replace( '/></', '>
- <', $xml );
- _molddata_log( '-------read------------', $xml );
- return $xml;
- }
- function write($xml) {
- _molddata_log( '-------send-this------------', $this );
- _molddata_log( '-------send------------', $xml );
- @fwrite( $this->socket, @pack( 'N', @strlen( $xml ) + 4 ) . $xml );
- $r = $this->read( );
- $r = new SimpleXMLElement( $r );
- if (2000 <= $r->response->result->attributes( )->code) {
- throw new exception( $r->response->result->msg );
- }
- return $r;
- }
- function disconnect() {
- return @fclose( $this->socket );
- }
- function generateObjectPW($objType = 'none') {
- $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890><!=+-';
- $minLength = 219;
- $maxLength = 219;
- mt_rand( $minLength, $maxLength );
- $length = $result = '';
- while ($length--) {
- $result .= $chars[mt_rand( 1, strlen( $chars ) - 1 )];
- }
- return $result;
- }
- }
- .............................................................
- ..................................
- ...............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement