Jump to content

Licensing Addon Hook

Recommended Posts

I have purchased the licensing add on and all good but I need to have it so that on first use of my PHP software I am selling the code can update the license information (if empty) with the IP, domain and directory automatically so the software purchase and install can be fully automated.


Are there any hooks into this module? How can I achieve this.





Link to comment
Share on other sites

Other licensing system have this. Surely all we need is a flag in the license verification to say if the licensing info is empty (IE just issued) then to populate it with those details we are just passing across.


That way the first time an install is licensed and that license is verified the license take that IP, domain and directory.


If building a flag in to achieve that isn't possible then how about giving an API hook into the licensing module so we can capture and act on the information passed?

Link to comment
Share on other sites

You don't get what I mean or maybe I mis-interprated your question.

OK... you have your script with the licensing code built in.

you have it packaged up in a zip ready for a download.

A client orders it... generally from their dsl/internet connection (generally not the server that the script is going to be on)

client downloads and installs the script and runs it for the first time

The script can get the domain, directory, ip etc but it needs a license key to be able to send that info back to the licensing server so that you know exactly who it was for or was suposed to be for.

You could generate a license key from a combination of the domain,directory, and ip but how are you to know then on the licensing server who that key is for... what account do you marry it up with?

Unless each download of your script has some sort of unique key to identify each script, I can't see a way to do what you want!

Link to comment
Share on other sites

Sorry, me not being clear enough. Here goes a second attempt.


I create a web application, PHP, Ioncube encoded in a zip (or whatever)


Client purchases this through my WHMCS install and is issued, in real time, with a license key. This license key is blank in terms of IP, domain and directory as we don't have that information at order time for all the reasons stated above.


The client then installs the application on their web server which takes them through my install routine. Part of which asks them for the license key they have just purchased.


At install I then want this license key to be verified against the license server (WHMCS) and if the details for the key (IP, Domain and Directory) are empty (ie it is a new and unused key) to populate that information against that license key automatically hence locking that license key to that installation automatically.


I have kind of answered my own question here in that I could write a soap server that receives the key, does the checks and then populates the database directly from a soap client in the install routine but it would be much neater if this could be done through the licensing addon. All that would be needed is as bit flag in the current verify routine to say "populate if empty", value of flag if non zero indicating which if the three parts to populate and the associated code to do so.


Hope that makes sense? Basically as it stands it seems to me someone can purchase a license but it isn't locked to an installation until that information is manually added by a WHMCS admin. I would just like to automate this process on installation of the sold software.

Link to comment
Share on other sites

At install I then want this license key to be verified against the license server (WHMCS) and if the details for the key (IP, Domain and Directory) are empty (ie it is a new and unused key) to populate that information against that license key automatically hence locking that license key to that installation automatically.


It should already do this if you followed the coding sample

Link to comment
Share on other sites

Sadly not. I've tried three different licenses and three different installs so far and each time I install my software and use the license key the first time I call the verify script using the above code it just returns that the IP is invalid and when I check the WHMCS database (mod_licensing) the IP, domain and directory are still empty for that key:



<message>IP Address Invalid</message>


I am calling $results = check_license($licensekey,''); where $licensekey is a real unused license key.

Link to comment
Share on other sites

A sample hook script calling the license functions.


Then in your admin module you call your hook script above once to check it.



Don't forget your license form and database checks where the key is suppose to be stored at.

Link to comment
Share on other sites

Thanks for that, it's pretty much what I already have. The issue is even with that I am still getting invalid IP returned on a newly issued key that has an empty IP, Domain and Directory entry. The only way to rectify this seems to be to use WHMCS admin->Utilities->Addon Modules->Licenses Manager to manually enter in the IP, Domain and Directory once I have learnt it. It isn't added automatically the first time the license verify is called on the empty license.

Link to comment
Share on other sites

Sounds like you have an error in your check code somewhere. I know that you won't want to post your code here so if you like you can PM me it or contact me via msn and I'll take a quick look for you.

Also make sure that you can get to the verify script on your server.



It might be that access to it is being blocked due to something in your htaccess

Link to comment
Share on other sites

Hi Guys, thanks for all the help so far, really appreciate your time. My code, for testing purposes, is the stock sample code from the module with a real license code and empty localkey variable.


It posts to the verify script fine as, if I manually in WHMCS admin add the ip, domain and direcotry to the license all works well and comes back active.


So the verify URL is fine, firewall is fine, etc. All looks good. The only issue I have is when I (a client) purchases a new license, which is of course empty in terms of ip domain and directory, then the client installs my software with the license key, verify is called and fails due to the license server returning invald IP as above.


Once I populate the license information manually all works fine and I get an active response. It's just the automatic population of the license data on the server at install time that isn't working.


Sparky, thanks for the offer of PM, will do in a few minutes.

Link to comment
Share on other sites


It sounds like you just need to reissue the key. If the key is "Active" and no details set then they won't automatically populate, but if you hit the "Reissue" button, once in the "Reissued" status, the next location the license is used in will be the details that are saved as the valid location. It's fully automated and reissued is the default status all new licenses start out with.



Link to comment
Share on other sites

  • 1 month later...



I am a bit stuck in this one, how should i send the the ip when i have multiple ips.


1. License is in Reissue state

2. Request for a verify with one ip and it works

3. Request a verify with 2 ips seperated with comma (ex : ",") this sends a Invalid state with message "IP Address Invalid" and the state of the license is "Active" with both the ips provided.


Can anyone tell me why do i get the Invalid state as return or how to register multiple ips when license is reissued.

Link to comment
Share on other sites

Join the conversation

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

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