XF 2.1 PHP Function in an add-on

Hello ,

I need to add a license system for my add-on for avoir share and i just need to add this on my add-on :
PHP:
require_once '../test.php';
$api = new LicenseBoxAPI(); 
$res = $api->verify_license();
if($res['status']!=true){
  die('Your license is invalid, please contact support.');
}
But i really dont know how to integrate this on my addon.
I just want it to display an error message like Your license is invalid, please contact support.

Thank in advance for your help :) and sorry for my bad english xD
 
Last edited:
I have try to add this in the controller:

PHP:
protected function preDispatchController($action, ParameterBag $params)
    {
        $rootDir = $_SERVER['DOCUMENT_ROOT'];
        require($rootDir . '/test.php');
        if ($res['status']!=true)
        {
            return $this->noPermission();
        }
    }

But it's not work :(
 
An issue to consider there is that the source code of your plugin unless there's some sort of obfuscation or decryption that happens with the license system, anyone could just comment that block of code out and use your plugin without a license, unless I'm missing something that's a completely trivial bypass. I'd consider carefully whether a license check is worth the time and will actually protect your plugin from piracy.
 
Back
Top Bottom