-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathframe.php
More file actions
392 lines (306 loc) · 11.5 KB
/
Copy pathframe.php
File metadata and controls
392 lines (306 loc) · 11.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
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
<?php
// 3xpush Script - Push Subscription Management System
// Copyright 2020 Evgeniy Orel
// Site: https://script.3xpush.com/
// Email: script@3xpush.com
// Telegram: @Evgenfalcon
//
// ======================================================================
// This file is part of 3xpush Script.
//
// 3xpush Script is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// 3xpush Script is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with 3xpush Script. If not, see <https://www.gnu.org/licenses/>.
//======================================================================
ini_set('display_errors',false);
error_reporting(0);
header('Content-Type: text/html; charset=utf-8');
require_once("include/mysql.php");
require_once("include/func.php");
require_once("include/info.php");
include_once 'include/devicedetector/spyc/Spyc.php';
include_once 'include/devicedetector/autoload.php';
use DeviceDetector\DeviceDetector;
$locale = get_lang();
$settings = settings();
$text = text_filter($_GET['text']);
$sid = intval($_GET['sid']);
$subid = text_filter($_GET['subid']);
$price = text_filter($_GET['price']);
if (!$sid) exit;
$sites = sites("AND id='$sid'");
$host = get_host();
if ($sites[$sid]['iframe_options']) {
$iframe_options = json_decode($sites[$sid]['iframe_options'], true);
if ($iframe_options['text'] && $iframe_options['nogettext']==1) $text = $iframe_options['text'];
}
$agent = getenv("HTTP_USER_AGENT");
$deviceDetector = new DeviceDetector($agent);
$deviceDetector->parse();
$br = $deviceDetector->getClient();
list($brid) = $db->sql_fetchrow($db->sql_query("SELECT id FROM browsers WHERE `key` = '".$br['name']."'"));
$db->sql_query('INSERT INTO daystat (date, sid, subid, land_views, traf_cost)
VALUES (CURRENT_DATE(), ' . $sid . ', "'.$subid.'", 1, "'.$price.'")
ON DUPLICATE KEY UPDATE land_views=land_views+1, traf_cost=traf_cost+'.$price.'');
$db->sql_query('INSERT INTO browser_stat (date, browser_id, sid, land_views, traf_cost)
VALUES (CURRENT_DATE(), "'.$brid.'", ' . $sid . ', 1, "'.$price.'")
ON DUPLICATE KEY UPDATE land_views=land_views+1, traf_cost=traf_cost+'.$price.'');
if (!$text) {
if ($locale == "ru") {
$text = "<div class=text><img src=img/warn.png border=0><br>Подтвердите, что вы не робот, нажмите<br> <div class=allow>РАЗРЕШИТЬ</div></div>";
} else {
$text = "<div class=text><img src=img/warn.png border=0><br>Confirm that you are not a robot, click <div class=allow>ALLOW</div></div>";
}
} else {
$text = "<div class=text><img src=img/warn.png border=0><br>".$text."</div>";
}
?>
<style>
.text {display: block;
text-align: center;
margin-top: 15%;
font-family: tahoma;
}
.allow {
display: inline-block;
background-color: #ececec;
color: #545454;
padding-right: 10px;
padding-left: 10px;
font-weight: normal;
border-radius: 3px;
font-size: 26px;
}
.iframe, .top-layer {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
border: none;
margin: 0;
padding: 0;
overflow: hidden;
}
.top-layer {
position: absolute;
opacity: 0.85;
z-index: 100;
background-color: black;
}
.title {
color: white;
text-align: center;
letter-spacing: 2px;
padding: 40px;
opacity: 1
}
</style>
<iframe src="" class="iframe"></iframe>
<div class="top-layer">
<h2 class="title">
<?php echo $text; ?>
</h2>
</div>
<script src="https://www.gstatic.com/firebasejs/5.2.0/firebase.js"></script>
<script>
function transferHashToEnd() {
var hashItems = window.location.href.split('#');
if (hashItems[1].indexOf('&') === -1) {
return false;
}
var indexStart = hashItems[1].indexOf('&');
hashItems[0] += hashItems[1].slice(indexStart);
hashItems[1] = hashItems[1].slice(0, indexStart);
document.location.href = hashItems[0] + '#' + hashItems[1];
}
transferHashToEnd();
function getCookie(name) {
let matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
function setCookie(name, value, options) {
options = options || {};
let expires = options.expires;
if (typeof expires === "number" && expires) {
var d = new Date();
d.setTime(d.getTime() + expires * 1000);
expires = options.expires = d;
}
if (expires && expires.toUTCString) {
options.expires = expires.toUTCString();
}
value = encodeURIComponent(value);
let updatedCookie = name + "=" + value;
for (let propName in options) {
updatedCookie += "; " + propName;
let propValue = options[propName];
if (propValue !== true) {
updatedCookie += "=" + propValue;
}
}
document.cookie = updatedCookie;
}
let hash = window.location.hash.slice(1);
let items = hash.split('&');
function getParam(paramName) {
var url = new URL(document.location.href);
var param = url.searchParams.get(paramName);
return param;
// let paramIndex = hash.indexOf(paramName),
// paramStr;
//
// if (hash.indexOf('&', paramIndex) !== -1) {
// paramStr = hash.slice(paramIndex, hash.indexOf('&', paramIndex));
// } else {
// paramStr = hash.slice(paramIndex);
// }
//
// let param = paramStr.slice(paramStr.indexOf('=') + 1);
//
// return param;
}
let repeatString = window.location.search.match(/r=\d+/g);
if (repeatString) {
var repeat = repeatString[0].slice(repeatString[0].indexOf('=') + 1);
}
let noredirectStr = window.location.search.match(/noredirect=\d+/g);
if (noredirectStr) {
var noredirect = noredirectStr[0].slice(noredirectStr[0].indexOf('=') + 1);
console.log(noredirect);
}
let repeatCount = getCookie('repeatCountFrame');
let psx_host = '<?php echo $host; ?>',
psx_site_id = getParam('sid'),
psx_sub_id = getParam('subid'),
psx_tag = getParam('tag'),
psx_postback;
if (!repeatCount || repeatCount === "NaN") {
setCookie('repeatCountFrame', '0', {domain: '.'+psx_host});
}
let linkItems = items.filter(function (item) {
return item.indexOf('sid') === -1 && item.indexOf('tag') === -1 && item.indexOf('subid') === -1;
});
var link = '';
linkItems.forEach(function (item, i) {
if (i === 0) {
link += item;
} else {
link += '&' + item;
}
});
function randomInteger(min, max) {
var rand = min + Math.random() * (max + 1 - min);
rand = Math.floor(rand);
return rand;
}
let frame = document.querySelector('.iframe');
frame.setAttribute('src', link);
function subscribe() {
messaging.requestPermission()
.then(function () {
messaging.getToken()
.then(function (currentToken) {
console.log(currentToken);
if (currentToken) {
sendTokenToServer(currentToken);
if (+repeat <= +repeatCount || !repeat) {
setTimeout(function () {
window.location = link;
}, 1000);
} else {
repeatCount = getCookie('repeatCountFrame');
repeatCount++;
setCookie('repeatCountFrame', String(repeatCount), {domain: '.'+psx_host});
window.location.host = randomInteger(1, 1000000) + '.'+psx_host;
}
} else {
console.warn('cant get token.');
setTokenSentToServer(false);
}
}).catch(function (err) {
console.warn('getting token error.', err);
setTokenSentToServer(false);
});
})
.catch(function (err) {
console.warn('not allow to show message.', err);
var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://' + psx_host + '/req.php?type=7&sid=' + psx_site_id + '&sub=' + psx_sub_id, true);
xhr.send();
if (noredirect) {
window.location = link;
return;
}
window.location.host = randomInteger(1, 1000000) +'.'+ psx_host;
});
}
function sendTokenToServer(currentToken) {
if (!isTokenSentToServer(currentToken)) {
httpRequest = new XMLHttpRequest();
httpRequest.open('GET', 'https://' + psx_host + '/create.php?type=1&sid=' + psx_site_id + '&sub=' + psx_sub_id + '&tag='+psx_tag+'&t=' + currentToken, true);
httpRequest.send();
setTokenSentToServer(currentToken);
} else {
console.log('token already sended.');
}
}
function isTokenSentToServer(currentToken) {
return window.localStorage.getItem('sentFirebaseMessagingToken') == currentToken;
}
function setTokenSentToServer(currentToken) {
window.localStorage.setItem(
'sentFirebaseMessagingToken',
currentToken ? currentToken : ''
);
}
function init() {
<?php echo $settings['firebase_conf']; ?>
try {
firebase.initializeApp(config);
messaging = firebase.messaging();
if (Notification.permission !== 'granted') {
console.log('try to subscribe');
var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://' + psx_host + '/req.php?type=1&sid=' + psx_site_id + '&sub=' + psx_sub_id, true);
xhr.onreadystatechange = function () {
if (this.readyState == 4) {
localStorage.clear();
if (!localStorage.getItem('sentFirebaseMessagingToken')) {
subscribe();
}
;
var x = 0;
}
};
xhr.send();
} else {
window.location = link;
}
} catch (e) {
console.log('cant init ' + e);
setTimeout(init, 1000);
}
}
if ('Notification' in window) {
if (Notification.permission === 'granted') {
setTimeout(function () {
window.location = link;
}, 1000);
}
init();
}
</script>