Ok, I am writing a system called "FreeLock" (similar to CodeLock)
It works fine, except for when an include is called for...
the encoded script looks like this :
<?php $use_zlib='y'; $script_name='test.php';
include('freelock.php'); exit;?>
ENCRYPTED DATA IS AT THE END OF THE FILE
Here is freelock.php :
<?php
##############################
### FreeLock Include v1.0b ###
### by Brian Gardner ###
##############################
$freelock_active = 'y'; //so that we know it is already included
function read_script() {
global $script_name; //set in the running script
$script = file_get_contents($script_name);
return $script;
}
function get_enc_script($script) {
$ex = explode('---B---',$script);
return $ex[1];
}
// *VERY* simple scramble --- for testing only
function case_swap($input) {
for($i=0;$i<strlen($input);$i++) {
if(ereg('[a-z]',$input[$i])) {
$input[$i] = strtoupper($input[$i]);
} else if(ereg('[A-Z]',$input[$i])) {
$input[$i] = strtolower($input[$i]);
} else {}
}
return $input;
}
function decode_xlate($input) {
return case_swap($input);
}
function decode_script($script) {
global $use_zlib;
$script = decode_xlate($script);
if($use_zlib == 'y') {
$script = gzinflate(base64_decode($script));
} else {
$script = base64_decode($script);
}
return $script;
}
function freelock_run() {
eval(decode_script(get_enc_script(read_script())));
}
if($freelock_active == 'y') {
freelock_run();
}
?>
Any ideas? I am using include_once now, and tried calling the freelock_run() function explicitly, but it causes PHP to crash Apache...
I'm at a loss here. An encoder isn't much good if it can't include files, is it?
Thanks in advance.