Jump to content

Basic Licensing addon tutorial - for those who need a little extra help - UPDATED


Recommended Posts

I wrote a guide for this a while back and posted it here on the WHMCS forums. My previous guide included no code and was a bit confusing. I have updated my new guide with actual code and an example to help anyone out. Feel free to contact me with any question.

 

How to configure and setup WHMCS Licensing addon

http://markustenghamn.com/configure-setup-whmcs-licensing-addon

 

Old thread (Feel free to merge or close)

http://forum.whmcs.com/showthread.php?t=31882

 

Best regards,

Markus

Link to comment
Share on other sites

ive copied this from your site i hope you dont mind, its just for this.

 

if ($results["status"]=="Active") {
   # Allow Script to Run
   if ($results["localkey"]) {
       # Save Updated Local Key to DB or File
       $localkeydata = $results["localkey"];
   }
} elseif ($results["status"]=="Invalid") {
   # Show Invalid Message
} elseif ($results["status"]=="Expired") {
   # Show Expired Message
} elseif ($results["status"]=="Suspended") {
   # Show Suspended Message
}

 

could be this, cleaner, faster i wouldnt know without a few thousand iterations to test. but i should think it would be.

 

switch ($results['status'])
{
       case 'Active':
               //allow to run
               //update local as required
       break;

       case 'Inactive':
       case 'Expired':
       case 'Suspended:
       default:
               //show status message here
               $result = "Your license key is $result['status']";
       break;
}

Link to comment
Share on other sites

  • 3 weeks later...
ive copied this from your site i hope you dont mind, its just for this.

 

if ($results["status"]=="Active") {
   # Allow Script to Run
   if ($results["localkey"]) {
       # Save Updated Local Key to DB or File
       $localkeydata = $results["localkey"];
   }
} elseif ($results["status"]=="Invalid") {
   # Show Invalid Message
} elseif ($results["status"]=="Expired") {
   # Show Expired Message
} elseif ($results["status"]=="Suspended") {
   # Show Suspended Message
}

 

could be this, cleaner, faster i wouldnt know without a few thousand iterations to test. but i should think it would be.

 

switch ($results['status'])
{
       case 'Active':
               //allow to run
               //update local as required
       break;

       case 'Inactive':
       case 'Expired':
       case 'Suspended:
       default:
               //show status message here
               $result = "Your license key is $result['status']";
       break;
}

 

Thanks, yea that's another good way of doing it. I personally like to use the if else solution :)

 

Thanks for the good feedback i received so far and I hope it helps, if you need any help just contact me, I have already helped a few people.

Link to comment
Share on other sites

  • 4 weeks later...

Can someone please better explain the local key? Is this hardcoded into the script or is it generated for each new install, stored in a file and then used to compare it to the license key?

 

This is the only part I am confused about.

Link to comment
Share on other sites

The local key is generated when the application call the licensing server. This local key will include the "allowed domains, directories, IPs, and other data related to the license as well as a Date/Time value. the data/time value is used to make the local key expired after some time (You can set this time at the code). when the local key is expired the system should call the licensing server again to get another local key.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
  • 1 year later...

I followed the information WHMCS provided and this guide, I still am unable to get the licensing module to work. Every time I try it shows a blank page with no errors. When I check my whmcs admin area on License requests, it doesn't display anything like the script isn't "phoning home" would anyone be able to offer assistance?

 

Thanks you.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated