Advertisement
Guest User

Untitled

a guest
Jan 17th, 2012
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <?php
  2. // CONFIGURATION
  3. $whmcs_url = 'https://www.fsihost.biz/customerarea/clientarea.php';
  4. $license_url = 'https://www.whmcs.com/members/modules/servers/licensing/verify.php';
  5.  
  6. // MAIN CODE
  7. function url_get( $url )
  8. {
  9. $ch = curl_init();
  10. curl_setopt( $ch, CURLOPT_URL, $url );
  11. curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
  12. curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
  13. curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
  14.  
  15. $data = curl_exec( $ch );
  16. curl_close( $ch );
  17.  
  18. return $data;
  19. }
  20.  
  21. function url_post( $url, $data )
  22. {
  23. $ch = curl_init();
  24. curl_setopt( $ch, CURLOPT_URL, $url );
  25. curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
  26. curl_setopt( $ch, CURLOPT_POST, true );
  27. curl_setopt( $ch, CURLOPT_POSTFIELDS, $data );
  28. curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
  29. curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
  30.  
  31. $data = curl_exec( $ch );
  32. curl_close( $ch );
  33.  
  34. return $data;
  35. }
  36.  
  37. // Fetch license information
  38. $whmcs_data = url_get( $whmcs_url.'?licensedebug=1&forceremote=1' );
  39.  
  40. // Be sure this isn't a nulled version
  41. if( strpos( $whmcs_data, 'Performing Remote Check' ) !== false && strpos( $whmcs_data, 'Array' ) !== false )
  42. {
  43. // Array to save license fields
  44. $license_save = array();
  45.  
  46. // License fields to grab
  47. $license_fields = array( 'licensekey', 'domain', 'ip', 'dir' );
  48.  
  49. // Grab the license fields
  50. foreach( $license_fields as $field )
  51. {
  52. // Field to grab
  53. $tograb = $field."] => ";
  54.  
  55. // Start position
  56. $start_pos = strpos( $whmcs_data, $tograb ) + strlen($tograb);
  57.  
  58. // End position
  59. $end_pos = $start_pos;
  60. while( $whmcs_data{$end_pos} != "\n" && $whmcs_data{$end_pos} != "\r" && $end_pos != strlen($whmcs_data))
  61. $end_pos++;
  62.  
  63. // Grab it
  64. $license_save[$field] = trim( substr( $whmcs_data, $start_pos, ($end_pos-$start_pos) ) );
  65. }
  66.  
  67. // Encode the license fields
  68. $whmcs_data = "";
  69. foreach( $license_save as $field => $value )
  70. $whmcs_data .= urlencode($field).'='.urlencode($value).'&';
  71.  
  72. // Perform the query
  73. $whmcs_data .= 'check_token='.urlencode( sha1( time() ) );
  74. $license_data = url_post( $license_url, $whmcs_data );
  75.  
  76. // Output its results
  77. if( PHP_SAPI == 'cli' )
  78. {
  79. echo $license_data;
  80. }
  81. else
  82. {
  83. echo '<pre>';
  84. echo htmlspecialchars($license_data);
  85. echo '</pre>';
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement