ionCube Logo
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


 
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder

ioncube_license_has_expired

Author Message
Sentro



Joined: 02 Jul 2015
Posts: 2
Location: Greece

PostPosted: Thu Jul 02, 2015 2:02 pm    Post subject: ioncube_license_has_expired Reply with quote

Hello,

I have some PHP files decoded and creating a license file for them ( using the GUI ).
Everything works fine, although when the license file expires ( after X time ) i get a complete white page.

I want to be able to "override" this and have a custom callback function that is going to redirect the user or print a message or whatever.

Problem is when i'm using the function ioncube_licence_has_expired() function i get nothing in return.

Code:
if(ioncube_license_has_expired()){

    echo ' licence expired';
    exit();
}else{
    echo "Your license has NOT EXPIRED.<hr/>";
}


I have tried with it being part of an encrypted file and in a file without encryption and got the same results. White page and the function returned nothing.

I've read about --license-check in the forum but i'm a little confused using the GUI and if i should add that to the license file for it to work.

Thanks
_________________
I just had a bad day
Back to top
View user's profile Send private message
Sentro



Joined: 02 Jul 2015
Posts: 2
Location: Greece

PostPosted: Thu Jul 02, 2015 3:10 pm    Post subject: Reply with quote

Figured it out eventually,

For anyone that might come across this and has the same difficulties

Below is my error callback file which is defined upon creating the license file from the GUI.
Careful not to encrypt the file though.

Code:
<?php

function ioncube_event_handler($err_code, $params)
{
    echo "<html><body>An error has occurred:<br><br>";

    switch ($err_code)
    {
        case ION_LICENSE_NOT_FOUND:
            echo "A license could not be found.";
            break;
        case ION_LICENSE_EXPIRED:
            echo "License has expired.";
            break;
        default:
            echo "An unknown error occurred.";
            break;
    }

    echo "</body></html>";
}

?>

_________________
I just had a bad day
Back to top
View user's profile Send private message
alastair



Joined: 23 Feb 2010
Posts: 189

PostPosted: Fri Jul 03, 2015 5:20 pm    Post subject: Reply with quote

Hi,

Yes, that is the way to do it in the callback file.

Please note though that you *can* encode the callback file provided that the callback file is not encoded to require the same license file. (Otherwise the callback file could not run for the same reason that the rest of the application cannot run.) This would mean that the callback file would have to be encoded separately from the rest of the application.
_________________
Alastair

ionCube
Back to top
View user's profile Send private message
PHPLicengine



Joined: 14 May 2009
Posts: 53

PostPosted: Sat Jul 04, 2015 11:26 pm    Post subject: Reply with quote

Just to add to what alastair said, the function should not be obfuscated too.
_________________
PHPLicengine
Back to top
View user's profile Send private message
pat15



Joined: 02 Feb 2017
Posts: 2

PostPosted: Wed May 17, 2017 5:38 pm    Post subject: Reply with quote

I want check license it could be by ioncube_event_handler where i can define $_SESSION['is_expired'] and if it's TRUE i want that application run normally but some function can be disabled by $_SESSION['is_expired']

Is there any option to do that?
Back to top
View user's profile Send private message
PHPLicengine



Joined: 14 May 2009
Posts: 53

PostPosted: Thu May 18, 2017 12:40 pm    Post subject: Reply with quote

That function is immediately called if a license error occured, so everything you need to do must be done within the function, you cannot set that session before that function call then use it within the function.
Otherwise you should uncheck automatic license validation option in GUI and use your own license checker.
_________________
PHPLicengine
Back to top
View user's profile Send private message
pat15



Joined: 02 Feb 2017
Posts: 2

PostPosted: Fri May 19, 2017 4:19 pm    Post subject: Reply with quote

Thank's PHPLicengine - this solution is ok for me Smile
Back to top
View user's profile Send private message
PHPLicengine



Joined: 14 May 2009
Posts: 53

PostPosted: Fri May 19, 2017 4:29 pm    Post subject: Reply with quote

You should be carefull with your custom license validator and it must be rock solid before you release your product.
If you just need to disable some functions, you can use a license property and fetch it to check if some functions should be disabled or not, instead of disabling some functions in license error function.
_________________
PHPLicengine
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum