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 SourceGuardian & phpSHIELD)
- *
- * @ Version : 1.1.6.0
- * @ Author : DeZender
- * @ Release on : 02.06.2013
- * @ Official site : http://DeZender.Net
- *
- */
- /**
- * Licensing Class.
- *
- * @author Andy Rockwell <andy@solidphp.com>
- */
- class licensing {
- /**
- * Validate licensing
- *
- * @param string $api_fingerprint
- * @param string $server
- * @param string $RPC
- * @param string $license
- * @return mixed string on error; array on success
- */
- static public function validate_license($api_fingerprint, $server, $RPC, $license) {
- $returned = licensing::parse_xml( licensing::validate_local_key( ) );
- if (( $returned['status'] == 'grab_new_key' || $returned['status'] == 'expired' )) {
- $returned = licensing::parse_xml( licensing::go_remote( $method, $server, $license ) );
- if (empty( $returned )) {
- $returned['status'] = 'invalid';
- }
- licensing::go_remote_api( $RPC, $api_fingerprint, $license );
- $returned = licensing::parse_xml( licensing::validate_local_key( true ) );
- }
- if (( $returned['status'] != 'active' && $returned['status'] != 'reissued' )) {
- if (empty( $returned )) {
- $returned['status'] = 'invalid';
- }
- $errors = false;
- if ($returned['status'] == 'suspended') {
- $errors = 'This license has been suspended.';
- } else {
- if ($returned['status'] == 'pending') {
- $errors = 'This license is pending admin approval.';
- } else {
- if ($returned['status'] == 'expired') {
- $errors = 'This license is expired.';
- } else {
- if ($returned['status'] == 'renew') {
- $errors = $returned['message'];
- } else {
- if (( $returned['status'] == 'active' && strcmp( md5( 'a666d67aae067313345c74abd7b666b0' . $token ), $returned['access_token'] ) != 0 )) {
- $errors = 'This license has an invalid checksum.';
- } else {
- if (!empty( $errors )) {
- $errors = false;
- }
- $errors = 'This license appears to be invalid.';
- }
- }
- }
- }
- }
- }
- if (!empty( $errors )) {
- $errors = false;
- }
- return ($errors ? $errors : $returned);
- }
- /**
- * Write the local license key to somewhere.
- *
- * @param string $local_key The local key data to write.
- * @return You choose.
- */
- static public function store_local_key($local_key) {
- $count = mysql_fetch_row( mysql_query( 'select count(*) from settings where set_name=\'license_local_key\'' ) );
- $query = 'update settings set set_value=\'' . $local_key . '\' where set_name=\'license_local_key\'';
- if (!$count[0]) {
- $query = ( 'insert into settings set set_name=\'license_local_key\', set_value=\'' . $local_key . '\'' );
- }
- return mysql_query( $query );
- }
- /**
- * Get the local key from where you stored it.
- *
- * @return string The local license key.
- */
- public function get_stored_local_key() {
- $local_key = mysql_fetch_assoc( mysql_query( 'select set_value from settings where set_name=\'license_local_key\' limit 0, 1' ) );
- return $local_key['set_value'];
- }
- /**
- * Write the best remote licensing method
- *
- * @param string $method Either phpaudit_exec_socket, phpaudit_exec_curl or file_get_contents
- * @return You choose.
- */
- static public function write_best_method($method) {
- $count = mysql_fetch_row( @mysql_query( 'select count(*) from settings where set_name=\'license_method\'' ) );
- $query = 'update settings set set_value=\'' . $method . '\' where set_name=\'license_method\'';
- if (!$count[0]) {
- $query = ( 'insert into settings set set_name=\'license_method\', set_value=\'' . $method . '\'' );
- }
- return mysql_query( $query );
- }
- /**
- * Get the best remote licensing method previously saved
- *
- * @return string The saved or default remote call method.
- */
- public function get_best_method() {
- $method = mysql_fetch_assoc( mysql_query( 'select set_value from settings where set_name=\'license_method\'' ) );
- if ($method['set_value']) {
- return $method['set_value'];
- }
- return 'phpaudit_exec_socket';
- }
- /**
- * Validate a local license key
- *
- * @return boolean $debug
- * @return array The results of validation.
- */
- static public function validate_local_key($debug = false) {
- $raw_array = licensing::parse_local_key( );
- if (( !@is_array( $raw_array ) || $raw_array === false )) {
- return '<verify status=\'grab_new_key\' message=\'The local license key was empty.\' />';
- }
- if (( $raw_array[9] && strcmp( @md5( 'a666d67aae067313345c74abd7b666b0' . $raw_array[9] ), $raw_array[10] ) != 0 )) {
- return '<verify status=\'invalid\' message=\'The custom variables were tampered with.\' />';
- }
- if (strcmp( @md5( 'a666d67aae067313345c74abd7b666b0' . $raw_array[1] ), $raw_array[2] ) != 0) {
- return '<verify status=\'invalid\' message=\'The local license key checksum failed.\' ' . $raw_array[9] . ' />';
- }
- if (( $raw_array[1] < time( ) && $raw_array[1] != 'never' )) {
- return '<verify status=\'expired\' message=\'Fetching a new local key.\' ' . $raw_array[9] . ' />';
- }
- if (( $raw_array[13] && strcmp( @md5( 'a666d67aae067313345c74abd7b666b0' . $raw_array[13] ), $raw_array[14] ) != 0 )) {
- return '<verify status=\'invalid\' message=\'The download controls were tampered with.\' />';
- }
- .................................................................
- ............................
- ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement