PDA

View Full Version : Muilti-Site + Custom Integer.



srpurdy
06-15-12, 05:35 PM
Hi,

Currently I'm in the planning stages of building a multi-site application, and one of the bottlenecks in my head is the licensing of the application. As a single site application everything works perfectly, However under a multi site application this would become a problem. Even allowing any domain name Still causes the script to re-write it's license key (access)

So I'm wondering if it's possible to get an option where certain license keys can be used on as many domains as needed. So that it doesn't attempt to call back and write the current access domain to the remote system. and instead would only include that domain as allowed access as well. This would stil be ip protected in this situation so I'm not too concerned with someone using that key on multiple servers. That wouldn't be possible.

Also I think it would be handy to have a custom integer that we as programmers can use for whatever we need to. In my case. I would like to have say a number like 25. Where this would limit the amount of sites the application can have. I can of course do this by hard coded this number into an encrypted file somewhere but I rather this information come remotely as it makes it a dynamic integer and is much easier to work with.

Sorry for making this so long, but to elaborate a bit on multi-site so I'm hopefully not being too confusing with my choice of wording.

->mainsite.com
------>subsite.mainsite.com
------>subsite.com
------>anothersubsite.com

All of these would use 1 code base, with variations on themes of course. They would also run they're own database. But it will all be connected through mainsite.com

I would think though making this option possible in the license add-on is rather trivial in comparison to what I'm doing. I just want to know if this is something that you guys could do. and also maybe others might be interested in this options. In other situations like domain-aliases for example this also becomes a problem too. So I think it would have more than 1 use.

Thanks :)

peterruiter
06-24-12, 08:23 PM
Hi Srpurdy,
The licensing addon has these options already.

When you go to your product setup and then pick the tab "Module settings", there is tickbox called "Allow Domain Conflict".
This will cause the domain not to be checked.

The extra fields that you are talking about are also already in the licensing module. If you want I would be happy to send you an example.

srpurdy
06-29-12, 04:59 PM
Hi,

Sorry for the late reply.

Except it actually does still "Write" the domain. That's the issue I'm having.

For example even with domain conflict off if I have domain1.com as the primary domain. and have an alias of domain2.com The only difference between the two is with it off it allows the application to work, where with it on it doesn't. So while it doesn't check for a valid domain. It still asks for a new local key every single time you access the application from a different domain.

With it off for example. If I access my application with domain1.com it writes the domain1.com to the license on the whmcs install. If I go now to domain2.com it than writes it again to domain2.com While the application works. I don't see why it should keep re-writing the allowed domain. For me it should attach both domains domain1.com and domain2.com should be listed. So it doesn't have to keep writing them and getting a new local key everytime.

So in a nutshell I'm trying to avoid a localkey getting written everytime someone uses the application. On a multi-site system it can easily be re-writing and creating a new localkey every few minutes.

As for the other option can you explain?

alaali
07-03-12, 03:16 PM
Can you please show us how to use the extra field.

Thanks,
Sayed


Hi Srpurdy,
The licensing addon has these options already.

When you go to your product setup and then pick the tab "Module settings", there is tickbox called "Allow Domain Conflict".
This will cause the domain not to be checked.

The extra fields that you are talking about are also already in the licensing module. If you want I would be happy to send you an example.

peterruiter
07-03-12, 03:42 PM
Sure,
I'm out right now but as soon as I get home I will look it up and will attach an example for you

peterruiter
07-08-12, 01:25 PM
Hi there...
I promised you an example... Better late then never.

If you attach an add-on to the licensed product then you can read it from the returned $results array that comes back from the licensing validator.

It will be in there like this:


[addons] => name=CustomAddonName1;nextduedate=2013-07-08;status=Active|name=CustomAddonName2;nextduedate =2012-07-08;status=Pending

As you can see the multiple addons will be seperated by a pipe ( | ).
You can put anything you want in the custom addon name.

I myself like to rewrite this result a bit so I can check for certain values more easy.

I use the following code to do so:


if ($results['addons']) {
$aAddons = explode('|',$results['addons']);
$aAddonRawData = array();
$aAddonCleanData = array();
foreach($aAddons as $aAddon) {
$aAddonRawData = explode(';',$aAddon);
$aAddonData = array();
foreach ($aAddonRawData as $k=>$v) {
list ($sAddonKey, $sAddonValue) = explode('=', $v);
$aAddonData[$sAddonKey] = $sAddonValue;
}
$aAddonCleanData[] = $aAddonData;
}
}


You then get the addons array from before as:


Array
(
[0] => Array
(
[name] => CustomAddonName1
[nextduedate] => 2013-07-08
[status] => Active
)

[1] => Array
(
[name] => CustomAddonName2
[nextduedate] => 2012-07-08
[status] => Pending
)

)


That way you can check like this:


foreach ($aAddonCleanData as $aCleanAddon) {
if ($aCleanAddon['name'] == 'CustomAddonName2' && $aCleanAddon['status'] == 'Active') {
return true;
}
}


If you need more info just pm me of if you think it will be usefull for others just reply here.

alaali
07-08-12, 08:32 PM
However you need to make this manually as you need to make the MAC address as the addon name.

peterruiter
07-09-12, 08:09 AM
However you need to make this manually as you need to make the MAC address as the addon name.

Correct. There is no other way to do this with the current Licensing module, other then to just write your own little wrapper for it.
That could also easily be done.

alaali
07-09-12, 09:31 AM
I prefer something from within the licensing addon. If WHMCS provide a way to put a custom field or something this will be better.

leemason
10-09-12, 11:27 AM
There is a hook for the licensing module which. Use to send a version number to the request.

Forgot what it is but next time I'm on my server I will paste it here.

Basically I use a product custom field and set the title to version, and the description to the version number. I then update this when I release a new version. This is an admin only field.

The in the hook function you can get the service Id which you can then select the custom field description using that data, then just return and array with the version stored and this gets sent back to the verify request with the other details.


I've been plying with it and I will be trying to make it work with additional custom fields too, will keep you posted.

alaali
10-13-12, 03:20 PM
I think there is a lot of improvement can be made on licensing addon.

I know that we can do a lot of things by hard code on our application or as a hook on whmcs. however a counter for the sites or PCs using the license is better to be kept at the addon itself rather than making short things long.

If we can set a custom fields attached to a license and those can be updated from whmcs admin interface or from the application itself, then this will make our life more easier.

We are planning to use the licensing addon to license our desktop application but we don't have a way to do what we want other than hard coded everything. We will just use it now to know that this license is a new license and not used before.

ioncube for example have a license system which will attach a license key with a pc. of course you need to send a generated key from the system to them to create your license key. but this is something good if you are selling desktop applications.

Even if you want to sell web applications and you want the user to be able to run it on 10 sites only. There is no way to do it directly. you need to generate 10 keys. which can be done by using the same key and counter (counter of number of sites using site URL).