Advertisement
Guest User

Untitled

a guest
Apr 8th, 2012
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.4.0
  8. * @ Author : DeZender
  9. * @ Release on : 30.03.2012
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class molddata_epp_client {
  15. var $socket = null;
  16. var $clTRID = 'undefined';
  17. var $isLogined = false;
  18. function molddata_epp_client($host = '', $port = 700, $ssl = false, $timeout = 1) {
  19. if ($host) {
  20. $this->connect( $host, $port, $ssl, $timeout );
  21. }
  22.  
  23. }
  24.  
  25. function connect($host, $port = 700, $ssl = false, $timeout = 1) {
  26. $config = molddata_getConfigArray( );
  27. if (!in_array( $host, preg_split( '/[\s\,]+/', $config['EPPServer']['Options'] ) )) {
  28. throw new exception( 'Cannot connect to server \'' . $host . '\': Unknown server' );
  29. }
  30.  
  31. $this->clTRID = str_replace( '.', '', round( microtime( 1 ), 3 ) );
  32. if (is_array( $ssl )) {
  33. $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'] ) );
  34. $context = stream_context_create( $opts );
  35. $this->socket = stream_socket_client( ( 'tls://' . $host . ':' ) . $port, $errno, $errmsg, $timeout, STREAM_CLIENT_CONNECT, $context );
  36. } else {
  37. $this->socket = fsockopen( 'tcp://' . $host, $port, $errno, $errmsg, $timeout );
  38. }
  39.  
  40. if (!$this->socket) {
  41. throw new exception( 'Cannot connect to server \'' . $host . '\': ' . $errmsg );
  42. }
  43.  
  44. return $this->read( );
  45. }
  46.  
  47. function login($login, $pwd) {
  48. $from = $to = array( );
  49. $from[] = '/{login}/';
  50. $to[] = htmlspecialchars( $login );
  51. $from[] = '/{pwd}/';
  52. $to[] = htmlspecialchars( $pwd );
  53. $from[] = '/{clTRID}/';
  54. $to[] = htmlspecialchars( $this->clTRID );
  55. $xml = preg_replace( $from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  56. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  57. <command>
  58. <login>
  59. <clID>{login}</clID>
  60. <pw>{pwd}</pw>
  61. <options>
  62. <version>1.0</version>
  63. <lang>en</lang>
  64. </options>
  65. <svcs>
  66. <objURI>urn:ietf:params:xml:ns:obj1</objURI>
  67. <objURI>urn:ietf:params:xml:ns:obj2</objURI>
  68. <objURI>urn:ietf:params:xml:ns:obj3</objURI>
  69. <svcExtension>
  70. <extURI>http://custom/obj1ext-1.0</extURI>
  71. </svcExtension>
  72. </svcs>
  73. </login>
  74. <clTRID>{clTRID}</clTRID>
  75. </command>
  76. </epp>' );
  77. $r = $this->write( $xml );
  78. $this->isLogined = true;
  79. return true;
  80. }
  81.  
  82. function logout() {
  83. if (!$this->isLogined) {
  84. return true;
  85. }
  86.  
  87. $from = $to = array( );
  88. $from[] = '/{clTRID}/';
  89. $to[] = htmlspecialchars( $this->clTRID );
  90. $xml = preg_replace( $from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  91. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
  92. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  93. xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
  94. <command>
  95. <logout/>
  96. <clTRID>{clTRID}</clTRID>
  97. </command>
  98. </epp>' );
  99. $r = $this->write( $xml );
  100. $this->isLogined = false;
  101. return true;
  102. }
  103.  
  104. function read() {
  105. _molddata_log( '-------read-this------------', $this );
  106. if (feof( $this->socket )) {
  107. throw new esxception( 'Connection appears to have closed.' );
  108. }
  109.  
  110. $hdr = @fread( $this->socket, 4 );
  111. if (empty( $$hdr )) {
  112. throw new exception( 'Error reading from server: ' . $php_errormsg );
  113. return null;
  114. }
  115.  
  116. $unpacked = unpack( 'N', $hdr );
  117. $xml = fread( $this->socket, $unpacked[1] - 4 );
  118. $xml = preg_replace( '/></', '>
  119. <', $xml );
  120. _molddata_log( '-------read------------', $xml );
  121. return $xml;
  122. }
  123.  
  124. function write($xml) {
  125. _molddata_log( '-------send-this------------', $this );
  126. _molddata_log( '-------send------------', $xml );
  127. @fwrite( $this->socket, @pack( 'N', @strlen( $xml ) + 4 ) . $xml );
  128. $r = $this->read( );
  129. $r = new SimpleXMLElement( $r );
  130. if (2000 <= $r->response->result->attributes( )->code) {
  131. throw new exception( $r->response->result->msg );
  132. }
  133.  
  134. return $r;
  135. }
  136.  
  137. function disconnect() {
  138. return @fclose( $this->socket );
  139. }
  140.  
  141. function generateObjectPW($objType = 'none') {
  142. $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890><!=+-';
  143. $minLength = 219;
  144. $maxLength = 219;
  145. mt_rand( $minLength, $maxLength );
  146. $length = $result = '';
  147. while ($length--) {
  148. $result .= $chars[mt_rand( 1, strlen( $chars ) - 1 )];
  149. }
  150.  
  151. return $result;
  152. }
  153. }
  154. .............................................................
  155. ..................................
  156. ...............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement