More actions
Encodes a file as base64 gzip compressed payload file.
<?php
$input_file = 'info.php';
$output_file = 'x.php';
function removePhpTags($content) {
$content = preg_replace('/^<\?php\s*/', '', $content);
$content = preg_replace('/\s*\?>$/', '', $content);
return $content;
}
$file_content = file_get_contents($input_file);
$file_content = removePhpTags($file_content);
$encoded = base64_encode(gzcompress($file_content));
$payload = "<?php eval(gzuncompress(base64_decode('$encoded')));?>";
file_put_contents($output_file, $payload);
?>