WP主题创建密匙并激活

Published
2023-01-11
浏览次数 :  16

// function to validate license key
function validate_license_key( $license_key ) {
    global $wpdb;
    $table_name = $wpdb->prefix . 'license_keys';

    // check if license key is valid and active
    $key = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE license_key = %s AND active = 1", $license_key ) );

    // check if license key is associated with the current website
    if ( $key && $key->website_url == site_url() ) {
        return true;
    } else {
        return false;
    }
}

  • 标签1
  • 标签1
  • 标签1
Top