8. Property Checking via Loader API
Ok, so now our license file contains the property we created we can check for this in our PHP file via the ionCube "
ioncube_file_properties" loader API function. If the property
exists and it's value is "locked", it's the restricted version. Here is a code example:
$icprop = ioncube_file_properties();
if (isset($icprop['versiontype']['value']) && $icprop['versiontype']['value'])==locked) {
// software locked..do appropriate action.
} else {
// software unlocked..do appropriate action.
}
A more complex example might be:
if (function_exists('ioncube_file_properties')) {
$icprop = ioncube_file_properties();
if (isset($icprop['versiontype']['value'])) {
switch ($icprop['versiontype']['value']) {
case 'locked':
// locked, do something..
break;
case 'unlocked':
// Unlocked, do appropriate action..
break;
default:
// Unknown, do appropriate action..
break;
}
} else {
// property doesn't exist, do appropriate action..
}
}
We are not going to go over the PHP functions/code used here. A basic understanding of PHP is assumed. So, basically you check for the value of the property and do an
appropriate action. You can have as many properties as you need.
You are probably wondering how the "unlocked" value above is possible above if the value in the property was set to "locked"? Read the next section and all will become clear.