|
Custom predefined constants |
Top Previous Next |
|
SourceGuardian also lets you define custom named constants during an encoding process, or within an external script license. Constant name/value pairs are stored internally in the encrypted area of the protected script or external license. They may be used for custom script locking or any other actions if you need to store a custom value in the protected script or script license file and then retrieve it from your PHP code.
Use --const name=value option in encode4, encode5 or licgen command. Use quotes if your constant name or its value contains any spaces or other special symbols:
encode4 --const "licensed_for=Robin Hood" myscript.php licgen --const "licensed_for=Robin Hood" script.lic
You may define only one constant with each --const option but you may add as many --const options as you need into the command line.
To get a predefined constant value from the PHP code use sg_get_const() function. This function is defined in the SourceGuardian loader.
Syntax: string sg_get_const( string )
Will return a predefined SourceGuardian constant value or FALSE if constant with the specified name is not defined. SourceGuardian constants names are *case sensitive*.
There are 5 constants predefined for each protected script:
|