-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathexample.php
More file actions
40 lines (34 loc) · 1.27 KB
/
example.php
File metadata and controls
40 lines (34 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* PHP Application Packer (PackApp.php)
*
* The usage sample
*
* @package Packer
* @author Vallo Reima
* @copyright (C)2015
*/
$ver = '5.4'; /* required PHP */
if (version_compare(PHP_VERSION, $ver, '<')) {
die("PHP $ver+ version is required");
} else {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
ini_set('log_errors', false);
}
require('PackApp.php'); // main class, loads the others if needed
$old = 'tests.zip'; // source zipped
$new = 'tests_pkd'; // destination folder
/* js and php obfuscation; maximum replacement of the PHP identifiers except 'vv' identifier; defined constants can be case-insensitive */
$obj = new PackApp(3, ['ids' => 'VdHFTC', 'exi' => ['vv']]); // instantiate
$rlt = $obj->Pack($old, $new, true); // pack the source and get result data; replace existing data
header('Content-Type: text/html; charset=utf-8');
if (is_string($rlt['factor'])) {
echo $rlt['factor']; // switch to setup
} else {
$r = $rlt['code'] == 'ok' ? 'string' : 'prompt'; // either protocol or message
echo (str_replace(["\t", "\n"], [' ', '<br>'], $rlt[$r])); // display with html
}
if ($rlt['code'] == 'ok') {//success
file_put_contents(pathinfo(__FILE__, PATHINFO_FILENAME) . '.txt', $rlt['string']); // save the protocol
}