-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
66 lines (58 loc) · 2.41 KB
/
index.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
<?php
/*
* Copyright (C) 2020 Sergey Ilyin <developer@ilyins.ru>
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
include_once 'config.php';
spl_autoload_register(function ($class) {
include 'classes/' . $class . '.class.php';
});
switch (filter_input(INPUT_SERVER, 'REQUEST_METHOD')) {
case 'POST':
$requestData = filter_input_array(INPUT_POST);
break;
case 'GET':
$requestData = filter_input_array(INPUT_GET);
break;
default:
break;
}
switch (filter_input(INPUT_SERVER, 'CONTENT_TYPE')) {
case 'application/json;charset=utf-8':
case 'application/json; charset=utf-8':
case 'application/json':
$requestHost = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
$requestID = filter_input(INPUT_SERVER, 'REQUEST_ID');
$requestJson = json_decode(file_get_contents("php://input"));
header("Content-type: application/json; charset=utf-8");
if (isset($requestJson->session->skill_id)) {
echo Yandex::getBalance($requestJson);
} else {
echo BGBilling::getContractsInfo($requestJson);
}
break;
case 'application/x-www-form-urlencoded':
botOLBX24::handler($requestData);
default:
if ((filter_input(INPUT_SERVER, 'HTTP_USER_AGENT') == 'curl/7.74.0' &&
filter_input(INPUT_SERVER, 'REMOTE_ADDR') == '10.1.1.125')||(
filter_input(INPUT_SERVER, 'REMOTE_ADDR') == '10.2.2.10')) {
$requestData['class']['method']($requestData['args']);
} else {
echo 'Silent is golden!';
}
break;
}
#file_put_contents('request.log', date('c') . " | $requestID | $requestHost | " . filter_input(INPUT_SERVER, 'REQUEST_METHOD') . " | " . filter_input(INPUT_SERVER, 'CONTENT_TYPE') . " | " . serialize($requestData) . PHP_EOL, FILE_APPEND);