Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter saleh talebi

    (@saleh0936)

    How should I change?
    you have a solution for this code:

    <?php
    define('YOUR_LICENSE_SERVER_URL','https://localhost');
    $api_params=array('slm_action'=>'slm_check','secret_key'=>'245454545445','license_key'=>get_option('sample_license_key'),);
    $response=wp_remote_get(add_query_arg($api_params,YOUR_LICENSE_SERVER_URL),array('timeout'=>20,'sslverify'=>false));
    $license_data=json_decode(wp_remote_retrieve_body($response));
    global $active,$message;if($license_data->result=='success'){
    ?>
    <?php }
    else{?>
    <?php wp_die(__('No License'));?><?php }?>

    This is the same as the license receipt form and its validation or deactivation:

    function sample_license_management_page () {
        echo '<div class = "wrap">';
        echo '<h2> Manage Template Licensing </ h2>';
        if (isset ($ _ REQUEST ['activate_license'])) {
            $ license_key = $ _REQUEST ['sample_license_key'];
            $ api_params = array (
                'slm_action' => 'slm_activate'
                'secret_key' => YOUR_SPECIAL_SECRET_KEY
                'license_key' => $ license_key
                'registered_domain' => $ _SERVER ['SERVER_NAME'],
                'item_reference' => urlencode (YOUR_ITEM_REFERENCE)
            );
            $ query = esc_url_raw (add_query_arg ($ api_params, YOUR_LICENSE_SERVER_URL));
            $ response = wp_remote_get ($ query, array ('timeout' => 20, 'sslverify' => false));
            if (is_wp_error ($ response)) {
                echo "Unexpected error! Query sent with an error.";
            }
            $ license_data = json_decode (wp_remote_retrieve_body ($ response));
            if ($ license_data-> result == 'success') {
                echo '<br /> The following message was returned from the server:'. $ license_data-> message;
    echo '<br /> Licensed successfully. ';
                update_option ('sample_license_key', $ license_key);
            }
            else {
                echo '<br /> The following message was returned from the server:'. $ license_data-> message;
            }
        }
        if (isset ($ _ REQUEST ['deactivate_license'])) {
            $ license_key = $ _REQUEST ['sample_license_key'];
            $ api_params = array (
                'slm_action' => 'slm_deactivate'
                'secret_key' => YOUR_SPECIAL_SECRET_KEY
                'license_key' => $ license_key
                'registered_domain' => $ _SERVER ['SERVER_NAME'],
                'item_reference' => urlencode (YOUR_ITEM_REFERENCE)
            );
            $ query = esc_url_raw (add_query_arg ($ api_params, YOUR_LICENSE_SERVER_URL));
            $ response = wp_remote_get ($ query, array ('timeout' => 20, 'sslverify' => false));
            if (is_wp_error ($ response)) {
                echo "Unexpected error! Query sent with an error.";
            }
    
            $ license_data = json_decode (wp_remote_retrieve_body ($ response));
    
            
            if ($ license_data-> result == 'success') {// Success was returned for the license activation
                echo '<br /> The following message was returned from the server:'. $ license_data-> message;
                echo '<br /> Licensed successfully. ';
                update_option ('sample_license_key', '');
            }
            else {
                echo '<br /> The following message was returned from the server:'. $ license_data-> message;
            }
            
        }
        ?>
        <p> Please enter the license key to activate the template, when you purchase the product, the license key has been delivered to you, if you do not have a license key, contact us.
    
    </ p>
        <formaction = "" method = "post">
            <table class = "form-table">
                <tr>
                    <th style = "width: 100px;"> <label for = "sample_license_key"> license key </ label> </ th>
                    <td> <input class = "regular-text" type = "text" id = "sample_license_key" name = "sample_license_key" value = "<? php echo get_option ('sample_license_key');?>"> </ td>
                </ tr>
            </ table>
            <p class = "submit">
                <input type = "submit" name = "activate_license" value = "activation" class = "button-primary" />
                <input type = "submit" name = "deactivate_license" value = "disable" class = "button" />
            </ p>
        </ form>
        <? php
        
        echo '</ div>';
    }
    ?>

    Please guide me

    Thread Starter saleh talebi

    (@saleh0936)

    What exactly should I do now?
    Please see more explanation …

    Thread Starter saleh talebi

    (@saleh0936)

    Hello
    Thank you for the answer
    Yes, that’s right
    I want a solution after the first activation of the license
    Until I send a message from my side to the customer’s site, it will not be disabled so that it will apply for approval at any time.

    As long as the site (license server) is disconnected for any reason, other customer sites (WordPress template) will not be disconnected.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)