Whmcs Licensing Add On Install

Whmcs Licensing Add On Install
We currently use WHMCS and have recently purchased and installed the Licensing Addon. It is successfully installed and it working via the admin. We now need it to work with a database in mySQL so that we can distribute scripts in a zip/rar file and have the licensing system generate a unique license for the install and call back to our database to verify that it is a valid install.

This is some of the info provided to us regarding the set up:

For database calls you would just use the regular PHP query functions. For example if you were to create a database table named “licensedata” with 2 text fields called licensekey and localkey then when you first install you would populate the licensekey value only, and then each time a license check needs to be performed, you would first use the Get Local Key section to retrieve the values then call the check_license function as in the sample code already provided, and then when that completes and is successful so you get a new local key returned, you would run the Update Local Key section of the below example:

$whmcsmysql = mysql_connect($db_host,$db_username,$db_password);
mysql_select_db($db_name) or die(“Could not connect to the database”);

# Get Local Key
$result = mysql_query(“SELECT licensekey,localkey FROM licensedata”);
$data = mysql_fetch_array($result);
$licensekey = $data[0];
$localkey = $data[1];

# Save Local Key
$result = mysql_query(“UPDATE licensedata SET localkey='”.mysql_real_escape_string($localkey).”‘”);


We will test the finished product with a couple of scripts by generating the download and installing to a correct domain and an incorrect domain.

Leave a Reply

Your email address will not be published. Required fields are marked *