-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
installer.php
433 lines (391 loc) · 12.9 KB
/
installer.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
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<?php
// Get server url
$url = 'https://' . $_SERVER['HTTP_HOST'];
// Output messages
$response = '';
/* Install function */
function install($config_file = 'system/config.php') {
$contents = '<?php' . PHP_EOL;
// Write new variables to files
foreach ($_POST as $k => $v) {
if ($k == 'code') continue;
$v = in_array(strtolower($v), ['true', 'false']) || is_numeric($v) ? strtolower($v) : '\'' . $v . '\'';
$contents .= 'define(\'' . $k . '\',' . $v . ');' . PHP_EOL;
}
$contents .= '?>';
if (!file_put_contents($config_file, $contents)) {
return FALSE;
}
return TRUE;
}
/*Verify Purchase Code function*/
function verify($code)
{
/*If the submit form is success*/
if(!empty($code)){
/*add purchase code to the API link*/
$purchase_code = $code;
$url = "https://dl.supers0ft.us/anonuptest/api.php?code=".$purchase_code;
$curl = curl_init($url);
/*Set your personal token*/
// $personal_token = "9COT6mduU2sZSMIlC09aYAQveaRdQ2H9";
/*Correct header for the curl extension*/
$header = array();
$header[] = 'Authorization: Bearer '.$personal_token;
$header[] = 'User-Agent: Purchase code verification';
$header[] = 'timeout: 20';
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
/*Connect to the API, and get values from there*/
$envatoCheck = curl_exec($curl);
curl_close($curl);
$envatoCheck = json_decode($envatoCheck);
/*Variable request from the API*/
$date = new DateTime(isset($envatoCheck->supported_until) ? $envatoCheck->supported_until : false);
$support_date = $date->format('Y-m-d H:i:s');
$sold = new DateTime(isset($envatoCheck->sold_at) ? $envatoCheck->sold_at : false);
$sold_at = $sold->format('Y-m-d H:i:s');
$buyer = (isset( $envatoCheck->buyer) ? $envatoCheck->buyer : false);
$license = (isset( $envatoCheck->license) ? $envatoCheck->license : false);
$count = (isset( $envatoCheck->purchase_count) ? $envatoCheck->purchase_count : false);
$support_amount = (isset( $envatoCheck->support_amount) ? $envatoCheck->support_amount : false);
$item = (isset( $envatoCheck->item->previews->landscape_preview->landscape_url ) ? $envatoCheck->item->previews->landscape_preview->landscape_url : false);
/*Check for Special Characters*/
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬]/', $code)){
return 'Not allowed to use special characters!';
}
/*Check for Empty Spaces*/
if(!isset($code) || trim($code) == ''){
return 'You need to fill up the input area!';
}
/*If Purchase code exists, But Purchase ended*/
if (isset($envatoCheck->item->name) && (date('Y-m-d H:i:s') >= $support_date)){
return "
<div class='alert alert-danger' role='alert'>
<h3>{$envatoCheck->item->name}</h3>
<div class='row'>
<div class='center-box'>
<div class='col-md-6'>
<img src='{$item}' class='img-responsive' />
</div>
<div class='col-md-6'>
<table class='table table-striped'>
<thead>
<tbody>
<tr>
<td><b>CLIENT:</b></td>
<td>{$buyer}</td>
</tr>
<tr>
<td><b>SOLD AT:</b></td>
<td> {$sold_at}</td>
</tr>
<tr>
<td><b>SUPPORT UNTIL:</b></td>
<td> {$support_date}</td>
</tr>
<tr>
<td><b>LICENSE:</b></td>
<td> {$license}</td>
</tr>
<tr>
<td><b>COUNT:</b></td>
<td> {$count}</td>
</tr>
<tr>
<td><b>SUPPORT EXTENSION:</b></td>
<td> {$support_amount}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
";
}
/*If Purchase code exists, display client information*/
if (isset($envatoCheck->item->name) && (date('Y-m-d H:i:s') < $support_date)){
if (!install()) {
return '<h3>Error!</h3><p>Could not write to file! Please check permissions and try again!</a>';
}
return "
<div class='alert alert-success' role='alert'>
<h3>{$envatoCheck->item->name}</h3>
<div class='row'>
<div class='center-box'>
<div class='col-md-6'>
<img src='{$item}' class='img-responsive' />
</div>
<div class='col-md-6'>
<table class='table table-striped'>
<thead>
<tbody>
<tr>
<td><b>CLIENT:</b></td>
<td>{$buyer}</td>
</tr>
<tr>
<td><b>SOLD AT:</b></td>
<td> {$sold_at}</td>
</tr>
<tr>
<td><b>SUPPORT UNTIL:</b></td>
<td> {$support_date}</td>
</tr>
<tr>
<td><b>LICENSE:</b></td>
<td> {$license}</td>
</tr>
<tr>
<td><b>COUNT:</b></td>
<td> {$count}</td>
</tr>
<tr>
<td><b>SUPPORT EXTENSION:</b></td>
<td> {$support_amount}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
";
}
/*If Purchase Code doesn't exist, no information will be displayed*/
if (!isset($envatoCheck->item->name)){
return "
<div class='alert alert-danger' role='alert'>
<h3>INVALID PURCHASE CODE.</h3>
<div class='row'>
<div class='center-box'>
<div class='col-md-6'>
<img src='img/profile.png' class='img-responsive' />
</div>
<div class='col-md-6'>
<table class='table table-striped'>
<thead>
<tbody>
<tr>
<td><b>CLIENT:</b></td>
<td> NOT VERIFIED</td>
</tr>
<tr>
<td><b>SOLD AT:</b></td>
<td> NONE</td>
</tr>
<tr>
<td><b>SUPPORT UNTIL:</b></td>
<td> NONE</td>
</tr>
<tr>
<td><b>LICENSE:</b></td>
<td> NONE</td>
</tr>
<tr>
<td><b>COUNT:</b></td>
<td> NONE</td>
</tr>
<tr>
<td><b>SUPPORT EXTENSION:</b></td>
<td> NONE</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
";
}
}
}
if ($_POST) {
if (isset($_POST['code'])) {
// Validate code
$response = verify($_POST['code']);
} else {
// No code specified
$response = '<h3>Error!</h3><p>Please enter your Envato code!</p>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>Installer</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<form class="installer-form" method="post" action="">
<h1><i class="fa-solid fa-box-open"></i>Installer</h1>
<div class="steps">
<div class="step current"></div>
<div class="step"></div>
<div class="step"></div>
<div class="step"></div>
<div class="step"></div>
</div>
<div class="step-content current" data-step="1">
<div class="fields">
<label for="email">Admin Email</label>
<div class="field">
<i class="fas fa-envelope"></i>
<input id="email" type="email" name="email" placeholder="Your Email Address" required>
</div>
<label for="password">Password</label>
<div class="field">
<i class="fas fa-lock"></i>
<input id="password" type="password" name="password" placeholder="Password" minlength="8" required>
</div>
<label for="app_name">App Name</label>
<div class="field">
<input id="app_name" type="text" name="app_name" placeholder="App Name" required>
</div>
<label for="app_desc">App Description</label>
<div class="field">
<input id="app_desc" type="text" name="app_desc" placeholder="App Description" required>
</div>
</div>
<div class="buttons">
<a href="#" class="btn" data-set-step="2">Next</a>
</div>
</div>
<div class="step-content" data-step="2">
<div class="fields">
<label for="FILELIST">File List</label>
<div class="field">
<input id="FILELIST" type="text" name="FILELIST" placeholder="Comma-seperated list of supported files" required value="jpeg,jpg,gif,png,zip,xls,doc,mp3,mp4,mpeg,wav,avi,rar,7z,txt">
</div>
<p>Options</p>
<div class="group">
<label for="size_verification">
<input type="checkbox" name="size_verification" id="size_verification">
Size Verification
</label>
</div>
<!-- file destination - do not change or script won't work -->
<div class="field">
<input id="file_destination" type="hidden" name="file_destination" placeholder="File Destination" value="files"readonly required>
</div>
<label for="file_destination">Site URL</label>
<div class="field">
<input id="file_destination" type="text" name="file_url_destination" placeholder="https://example.com/anonupload" value="<?php echo $url; ?>" required>
</div>
</div>
<div class="buttons">
<a href="#" class="btn" data-set-step="1">Prev</a>
<a href="#" class="btn" data-set-step="3">Next</a>
</div>
</div>
<div class="step-content" data-step="3">
<div class="fields">
<label for="max_size">Maximum Size In Bytes</label>
<div class="field">
<input id="max_size" type="number" name="max_size" placeholder="Maximum Size" required>
</div>
<label for="min_size">Minimum Size In Bytes</label>
<div class="field">
<input id="min_size" type="number" name="min_size" placeholder="Minimum Size" required>
</div>
<!-- OTHER FORM ELEMENTS
<p>Features</p>
<div class="group">
<label for="feature1">
<input type="checkbox" name="feature1" id="feature1">
Enable Feature 1
</label>
<label for="feature2">
<input type="checkbox" name="feature2" id="feature2">
Enable Feature 2
</label>
<label for="feature3">
<input type="checkbox" name="feature3" id="feature3">
Enable Feature 3
</label>
</div>
<p>Account Permissions</p>
<div class="group">
<label for="radio6">
<input type="radio" name="account_permissions" id="radio6" value="full">
Full
</label>
<label for="radio7">
<input type="radio" name="account_permissions" id="radio7" value="strict">
Strict
</label>
</div>
<p>Maximum number of accounts</p>
<div class="rating">
<input type="radio" name="maximum_accounts" id="radio1" value="5">
<label for="radio1">5</label>
<input type="radio" name="maximum_accounts" id="radio2" value="10">
<label for="radio2">10</label>
<input type="radio" name="maximum_accounts" id="radio3" value="20">
<label for="radio3">20</label>
<input type="radio" name="maximum_accounts" id="radio4" value="50">
<label for="radio4">50</label>
<input type="radio" name="maximum_accounts" id="radio5" value="80">
<label for="radio5">80</label>
</div>
-->
</div>
<div class="buttons">
<a href="#" class="btn alt" data-set-step="2">Prev</a>
<a href="#" class="btn" data-set-step="4">Next</a>
</div>
</div>
<div class="step-content" data-step="4">
<div class="fields">
<label for="code">Envato Code</label>
<div class="field">
<i class="fa-solid fa-key"></i>
<input id="code" type="text" name="code" placeholder="Your Purchase Code" required>
</div>
</div>
<div class="buttons">
<a href="#" class="btn alt" data-set-step="3">Prev</a>
<input type="submit" class="btn" value="Submit">
</div>
</div>
<div class="step-content" data-step="5">
<div class="result"><?=$response?></div>
</div>
</form>
<script>
document.querySelectorAll("input[type='checkbox']").forEach(checkbox => {
checkbox.onclick = () => checkbox.value = checkbox.checked ? 'true' : 'false';
});
const setStep = step => {
document.querySelectorAll(".step-content").forEach(element => element.style.display = "none");
document.querySelector("[data-step='" + step + "']").style.display = "block";
document.querySelectorAll(".steps .step").forEach((element, index) => {
index < step-1 ? element.classList.add("complete") : element.classList.remove("complete");
index == step-1 ? element.classList.add("current") : element.classList.remove("current");
});
};
document.querySelectorAll("[data-set-step]").forEach(element => {
element.onclick = event => {
event.preventDefault();
let canContinue = true;
document.querySelectorAll('input').forEach(element => {
if (!element.checkValidity() && element.offsetWidth !== 0 && element.offsetHeight !== 0) {
canContinue = false;
element.reportValidity();
}
});
if (canContinue) {
setStep(parseInt(element.dataset.setStep));
}
};
});
<?php if (!empty($_POST)): ?>
setStep(5);
<?php endif; ?>
</script>
</body>
</html>