Jump to content
bigideaguy

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

Share this post


Link to post
Share on other sites

Great job, there's been a lot of requests on this forum for better documentation regarding the licensing addon.

Share this post


Link to post
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;
}

Share this post


Link to post
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;
}

 

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.

Share this post


Link to post
Share on other sites

Thanks for the link. I was greatly helped by the existence of these guidelines, so I can know the mistakes that often occur when configuring the addon.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I will look into this and update my post as I stated in the other thread. Both threads should really be combined if an admin could possibly do this so we don't have two different conversations going on the same topic.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

So then do I really need to store the local key in a database and then recall it each time the script is run?

Share this post


Link to post
Share on other sites

If you do not store the local key the license will get validated remotely each time you call the script.

Problem with that setup is that when your validation server is down the license can't get validated.

 

The preferred setup would definitely be to store the local key and check that each time the script is run.

Share this post


Link to post
Share on other sites
Think this is really stupid.

 

Why? Some people have had trouble configuring this addon and have found the guide helpful?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines