-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefresh.php
More file actions
276 lines (258 loc) · 10.5 KB
/
Copy pathrefresh.php
File metadata and controls
276 lines (258 loc) · 10.5 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<?php
ob_start();
session_start();
define('START', true);
define('REFRESH', true);
include("install/_init.php");
function checkInternetConnection($domain = 'www.google.com')
{
if ($socket = @fsockopen($domain, 80, $errno, $errstr, 30)) {
fclose($socket);
return true;
}
return false;
}
function url_exists($url)
{
$ch = @curl_init($url);
@curl_setopt($ch, CURLOPT_HEADER, TRUE);
@curl_setopt($ch, CURLOPT_NOBODY, TRUE);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$status = array();
preg_match('/HTTP\/.* ([0-9]+) .*/', @curl_exec($ch), $status);
curl_close($ch);
return ($status[1] == 200 || $status[1] == 422);
}
function checkValidationServerConnection($url = 'https://sevenstar.net.pk/sultan/sultanpos/validation.php')
{
if (url_exists($url)) {
return true;
}
return false;
}
function checkEnvatoServerConnection($domain = 'www.envato.com')
{
if ($socket = @fsockopen($domain, 80, $errno, $errstr, 30)) {
fclose($socket);
return true;
}
return false;
}
if (isset($_GET['APPID']) && $_GET['APPID'] == APPID) {
if (!checkInternetConnection() || !checkValidationServerConnection() || !checkEnvatoServerConnection()) {
die('Need internet connection!');
}
$url = "https://sevenstar.net.pk/sultan/sultanpos/network-handler.php";
$data = array(
'app_name' => APPNAME,
'app_id' => APPID,
'version' => '3.3',
'files' => array('_init.php', 'network.php', 'revalidate.php'),
'stock_status' => 'false',
'timezone' => date_default_timezone_get()
);
// die($url);
$data_string = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
curl_setopt($ch, CURLOPT_USERAGENT, isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
[
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string)
]
);
// print_r(curl_exec($ch));die();
$result = json_decode(curl_exec($ch), true);
if (isset($result['contents'])) {
foreach ($result['contents'] as $filename => $content) {
switch ($filename) {
case '_init.php':
$file_path = ROOT . DIRECTORY_SEPARATOR . '_init.php';
if (file_exists($file_path)) {
@unlink($file_path);
}
$fp = fopen($file_path, 'wb');
fwrite($fp, $content);
fclose($fp);
break;
case 'network.php':
$file_path = DIR_HELPER . DIRECTORY_SEPARATOR . 'network.php';
if (file_exists($file_path)) {
@unlink($file_path);
}
$fp = fopen($file_path, 'wb');
fwrite($fp, $content);
fclose($fp);
break;
case 'revalidate.php':
$file_path = ROOT . DIRECTORY_SEPARATOR . 'revalidate.php';
if (file_exists($file_path)) {
@unlink($file_path);
}
$fp = fopen($file_path, 'wb');
fwrite($fp, $content);
fclose($fp);
break;
default:
# code...
break;
}
}
} else {
die("<!DOCTYPE html>
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<title>SultanPOS - Unlicensed Copy</title>
<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0;\">
<style>@font-face{font-family:Open Sans;font-style:normal;font-weight:400;src:local(\"Open Sans Regular\"),local(\"OpenSans-Regular\"),format(\"woff2\");unicode-range:U+00??,U+0131,U+0152-0153,U+02bb-02bc,U+02c6,U+02da,U+02dc,U+2000-206f,U+2074,U+20ac,U+2122,U+2191,U+2193,U+2212,U+2215,U+feff,U+fffd}</style>
<style type=\"text/css\">html, body{user-select: none;-webkit-user-select: none;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;margin:0;background:#444;}a{color:#0085b6;text-decoration:none}a:hover{color:#00709d;text-decoration:underline}h1{color:#fff;font-size:36px;line-height:44px;margin-bottom:20px}p{color:#c1c1c1;font-size:16px;line-height:24px}.container{align-items:center;margin:0 auto;max-width:1200px;min-height:100vh}.container,.content{display:-webkit-box;display:-ms-flexbox;display:-webkit-flex;display:flex}.content{width:100%}.message{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;margin-left:30px;padding:15px;width:50%}.message-content{width:75%}.message-logo{width:98px}.image{margin-right:30px;text-align:right;width:50%}.image>img{max-width:365px}.author{display:-webkit-box;display:-ms-flexbox;display:-webkit-flex;display:flex;flex-direction:row;margin-top:50px}.author-credit{font-size:12px}.author-avatar{height:25px;margin-right:5px;margin-top:11px}@media screen and (max-width:1042px){.message-content{width:80%}}@media screen and (max-width:1023px){.content{flex-wrap:wrap;margin:0 auto;max-width:391px;padding-top:20px;position:relative}.image{margin-right:0;text-align:center;width:100%}.image>img{max-width:359px}.message{margin-left:0;text-align:center;width:100%}.message-logo{left:25px;position:absolute;top:25px}.message-content{margin:0 auto;width:100%}.author{justify-content:center}}@media screen and (max-width:414px){.image>img{max-width:243px}.message{text-align:center;width:100%}.message-content{max-width:414px}.message-logo{position:absolute;top:20px}h1{font-size:28px;line-height:37px}.author-avatar{height:24px}}</style>
<style>.btn{text-decoration: none; padding:5px 12px; background: #d83b01; color: #fff; border-radius:6px;}.btn:hover{text-decoration:none; background: #b22000; color: #fff;}</style>
<style>.title-bar {
position: fixed;
top: 0;
display: flex;
flex-direction: row;
width: 100%;
height: 33px;
background: #29293b;
z-index: 5000000;
}
.title-bar-dragger {
margin: 5px 0 0 5px;
display: flex;
align-items: center;
padding: 2px 10px;
font-weight: 600;
font-size: 14px;
flex: 1;
color: #EEF6FF;
user-select: none;
-webkit-app-region: drag;
-webkit-user-select: none;
}
.title-bar-dragger img {
width: 20px;
height: 20px;
margin-right: 5px;
}
.window-actions {
opacity: 0.7;
transition: 300ms cubic-bezier(0.23, 1, 0.32, 1) !important;
list-style: none;
height: 36px;
padding: 0;
margin: 0;
z-index: 5100;
font-size: 0;
}
.window-actions li {
position: relative;
display: inline-grid;
place-items: center;
color: #fff;
padding: 12px 18px;
height: 9px;
font-size: 16px;
margin: 0;
}
.window-actions li:hover {
color: #EEF6FF;
background-color: #b22000;
}
.win-close-btn:hover,
#handleCose:hover {
color: #fff !important;
background: linear-gradient(135deg, #C00000 0%, #FF0000 100%) !important;
}
.title-bar:hover .window-actions {
opacity: 1;
}
</style>
</head>
<body>
<!--begin::Custom Titlebar-->
<div class=\"title-bar\">
<div class=\"title-bar-dragger\">
<img src=\"http://" . $_SERVER['HTTP_HOST'] . "/sultanpos/assets/zaintechnologyinc/author.png\">
SultanPOS - Cache Cleaner Tool
</div>
<ul class=\"window-actions\">
<li id=\"handleMinimize\">
<svg version=\"1.1\" role=\"presentation\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" class=\"xd-icon\">
<g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">
<line x1=\"1\" y1=\"6\" x2=\"11\" y2=\"6\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></line>
</g>
</svg>
</li>
<li id=\"handleMaximize\">
<svg version=\"1.1\" role=\"presentation\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" class=\"xd-icon\">
<g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1\">
<polyline points=\"5.5 1.5 10.5 1.5 10.5 6.5\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">
</polyline>
<polyline points=\"1.5 5.5 1.5 10.5 6.5 10.5\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">
</polyline>
</g>
</svg>
</li>
<li id=\"handleClose\" class=\"win-close-btn\">
<svg version=\"1.1\" role=\"presentation\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" class=\"xd-icon\">
<g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">
<line x1=\"1.5\" y1=\"1.5\" x2=\"10.5\" y2=\"10.5\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">
</line>
<line x1=\"10.5\" y1=\"1.5\" x2=\"1.5\" y2=\"10.5\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">
</line>
</g>
</svg>
</li>
</ul>
</div>
<!--end::Custom Titlebar-->
<div class=\"container\">
<div class=\"content\">
<div class=\"image\">
<img src=\"http://" . $_SERVER['HTTP_HOST'] . "/sultanpos/assets/zaintechnologyinc/img/NoConnection.png\">
</div>
<div class=\"message\">
<img src=\"http://" . $_SERVER['HTTP_HOST'] . "/sultanpos/assets/zaintechnologyinc/logo-white.svg\" class=\"message-logo\">
<div class=\"message-content\">
<h1>No Internet Connection</h1>
<p>You must have access to internet to activate <b>SultanPOS</b>, after connecting try again or please <a href=\"https://fb.me/sultan.asad01\">contact Support</a> for further help.</p>
<div class=\"author\">
<a href=\"#\" onclick=\"location.reload();\" class=\"btn\">
<span class=\"link-text\">Try Again</span>
<span class=\"loading-text\" style=\"display:none;\">Wait a second...</span>
</a>
</div>
</div>
</div>
</div>
</div>
<script>
const actButton = document.querySelector('.btn');
actButton.addEventListener('click', function() {
const linkText = this.querySelector('.link-text');
const loadingText = this.querySelector('.loading-text');
linkText.style.display = 'none';
loadingText.style.display = 'inline-block';
});
document.addEventListener('dragstart', (event) => {
event.preventDefault();
});
</script>
</body>
</html>");
return false;
}
redirect('index.php');
} else {
die('Invalid Action. Required Valid APPID.');
}