|
Creating custom encoded files from protected scripts |
Top Previous Next |
|
If your script generates files online and you need to secure them, it's now possible with SourceGuardian 7.0. Use sg_encode_file($filename, $data) SourceGuardian API function for creating the encoded file. This file will be encrypted in the same way as the SourceGuardian encoder encodes template files.
sg_encode_file($filename, $data);
Security note! The built-in SourceGuardian API encoder (sg_encode_file() API function) is suited only for encoding templates, data files and other non-PHP files. It does not perform compilation into bytecode and should not be used for securing source PHP scripts. Always use the SourceGuardian encoder for protecting PHP scripts as only bytecode compilation with encryption and compression can give maximum security for your PHP source scripts.
sg_encode_file() may generate the following error:
SourceGuardian Loader - error writing file "filename" [25] (loader failed to create an output file because of permissions, disk space etc problems)
This error is E_USER_ERROR and may be caught by custom error handler.
Files encoded using the sg_encode_file() SourceGuardian API function may be read by the sg_load_file() SourceGuardian API function described above. Files are encrypted using the current protected script's project identifier and key and so may be read only by the protected script encoded in the same SourceGuardian project.
If your protected script was encoded using advanced ip_encrypt or domain_encrypt options then the protected template file written by sg_encode_file() will be additionally encrypted using the current IP address (or domain name) as a key. This allows this protected template to be decrypted only on the machine with same IP (domain name).
|