Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // CONFIGURATION
- $whmcs_url = 'https://www.fsihost.biz/customerarea/clientarea.php';
- $license_url = 'https://www.whmcs.com/members/modules/servers/licensing/verify.php';
- // MAIN CODE
- function url_get( $url )
- {
- $ch = curl_init();
- curl_setopt( $ch, CURLOPT_URL, $url );
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
- curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
- $data = curl_exec( $ch );
- curl_close( $ch );
- return $data;
- }
- function url_post( $url, $data )
- {
- $ch = curl_init();
- curl_setopt( $ch, CURLOPT_URL, $url );
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
- curl_setopt( $ch, CURLOPT_POST, true );
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $data );
- curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
- $data = curl_exec( $ch );
- curl_close( $ch );
- return $data;
- }
- // Fetch license information
- $whmcs_data = url_get( $whmcs_url.'?licensedebug=1&forceremote=1' );
- // Be sure this isn't a nulled version
- if( strpos( $whmcs_data, 'Performing Remote Check' ) !== false && strpos( $whmcs_data, 'Array' ) !== false )
- {
- // Array to save license fields
- $license_save = array();
- // License fields to grab
- $license_fields = array( 'licensekey', 'domain', 'ip', 'dir' );
- // Grab the license fields
- foreach( $license_fields as $field )
- {
- // Field to grab
- $tograb = $field."] => ";
- // Start position
- $start_pos = strpos( $whmcs_data, $tograb ) + strlen($tograb);
- // End position
- $end_pos = $start_pos;
- while( $whmcs_data{$end_pos} != "\n" && $whmcs_data{$end_pos} != "\r" && $end_pos != strlen($whmcs_data))
- $end_pos++;
- // Grab it
- $license_save[$field] = trim( substr( $whmcs_data, $start_pos, ($end_pos-$start_pos) ) );
- }
- // Encode the license fields
- $whmcs_data = "";
- foreach( $license_save as $field => $value )
- $whmcs_data .= urlencode($field).'='.urlencode($value).'&';
- // Perform the query
- $whmcs_data .= 'check_token='.urlencode( sha1( time() ) );
- $license_data = url_post( $license_url, $whmcs_data );
- // Output its results
- if( PHP_SAPI == 'cli' )
- {
- echo $license_data;
- }
- else
- {
- echo '<pre>';
- echo htmlspecialchars($license_data);
- echo '</pre>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement