-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathexample_is_demo.php
83 lines (70 loc) · 2.13 KB
/
example_is_demo.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
////////////////////////////////////////////////////////////////////////////////
//
// StringEncrypt.com Web API usage example
//
// Version : v1.3
// Language : PHP
// Author : Bartosz Wójcik
// Web page : https://www.stringencrypt.com
//
////////////////////////////////////////////////////////////////////////////////
// include main library
include ("stringencrypt.php");
//
// setup options
//
$options = array();
//
// activation code, you can leave it empty for demo version, but keep in
// mind that in demo versions there are many limitations)
//
$options["code"] = "";
//
// API command to execute
//
// "encrypt" - encrypt input string or file bytes, returns array of:
//
// $result["error"] - error code
// $result["source"] - decryptor source code
// $result["expired"] - activation code expiration flag (bool)
// $result["credits_left"] - number of credits left
//
// "is_demo" - checks current activation code and returns array of:
//
// $result["demo"] - demo mode flag (bool)
// $result["label_limit"] - label limit length
// $result["string_limit"] - string/file limit lenght
// $result["credits_left"] - number of credits left
// $result["cmd_min"] - minimum number of encryption commands
// $result["cmd_max"] - maximum number of encryption commands
//$options["command"] = "encrypt";
$options["command"] = "is_demo";
//
// execute API command
//
$result = stringencrypt($options);
if ($result != false)
{
if ($result["demo"] == true)
{
echo "<p>You are running in DEMO mode</p>";
}
else
{
echo "<p>You are running in FULL mode</p>";
// display number of credits left
echo "<p>You have {$result['credits_left']} credits left.</p>";
// display initial number of credits
echo "<p>Initial number of credits {$result['credits_total']}.</p>";
}
echo "<p>Label max. length {$result['label_limit']} characters</p>";
echo "<p>String/file max. length {$result['string_limit']} characters</p>";
echo "<p>Minimum number of encryption commands {$result['cmd_min']}</p>";
echo "<p>Maximum number of encryption commands {$result['cmd_max']}</p>";
}
else
{
echo "Cannot connect to the API interface!";
}
?>