Files
redl 6ee2744e3a Сборка REDL: панель на PHP 8, капча-тумблер, закрытые уязвимости, установщики в один клик
- панель работает на PHP 8.4 (оригинал под PHP 7.0): elFinder utf8_encode, apache_get_modules, warnings
- капча выключена и управляется из админки (флаг captcha_enable + блок настроек)
- закрыты две SQL-инъекции без авторизации (createAuthLog: пароль из POST и CF-Connecting-IP)
- убрано хранение паролей в открытом виде в authlog, XSS в поле ref
- установщики install-panel.sh и install-node.sh (оригинальный затирал sources.list репозиториями Debian 9)
- современный Dockerfile (оригинальный на debian:stretch больше не собирается)
- планировщик и автозапуск работают без systemd
- брендинг REDL.IO, год 2026, ссылки на redl.io
- документация на русском: ИЗМЕНЕНИЯ, БЕЗОПАСНОСТЬ, ИНСТРУКЦИЯ
2026-07-30 02:00:01 +00:00

106 lines
3.2 KiB
PHP

<?php
/*
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
Developed by Samir Shelenko and Alexander Zemlyanoy (https://vk.com/id00v / https://vk.com/mrsasha082)
*/
class unitpayController extends Controller {
public function index() {
$this->load->model('users');
$this->load->model('invoices');
$this->load->model('waste');
error_reporting(0);
function md5sign($params, $secretKey) {
ksort($params);
unset($params['sign']);
return md5(join(null, $params).$secretKey);
}
function responseError($message) {
$error = array(
"jsonrpc" => "2.0",
"error" => array(
"code" => -32000,
"message" => $message
),
'id' => 1
);
echo json_encode($error); exit();
}
function responseSuccess($message) {
$success = array(
"jsonrpc" => "2.0",
"result" => array(
"message" => $message
),
'id' => 1
);
echo json_encode($success); exit();
}
$secretKey = $this->config->unitpay_secret;
$method = $_GET['method'];
$params = $_GET['params'];
if ($params['sign'] != md5($params, $secretKey)) {
responseError("Не соответсвие MD5 хешей");
}
switch($method) {
case 'check':
if (!$this->link = @mysqli_connect($this->config->db_hostname, $this->config->db_username, $this->config->db_password, $this->config->database)) {
die('Ошибка: Не удалось соединиться с сервером базы данных!');
}
break;
case 'pay':
if (!$this->link = @mysqli_connect($this->config->db_hostname, $this->config->db_username, $this->config->db_password, $this->config->database)) {
die('Ошибка: Не удалось соединиться с сервером базы данных!');
}
$invid = $_GET['params']['account'];
if(!$this->invoicesModel->getTotalInvoices(array('invoice_id' => (int)$invid))) {
responseError("Invalid invoice!");
}
$ammount = $_GET['params']['sum'];
$invoice = $this->invoicesModel->getInvoiceById($invid);
$userid = $invoice['user_id'];
$user = $this->usersModel->getUserById($userid);
if($invoice['invoice_ammount'] == $ammount){
if($ammount > 50){
$this->usersModel->updateUser($userid, $userData = array('user_promised_pay' => 0));
}
$wasteData = array(
'user_id' => $userid,
'waste_ammount' => $ammount,
'waste_status' => 0,
'waste_usluga' => "Пополнение баланса пользователя",
);
$this->wasteModel->createWaste($wasteData);
$this->usersModel->upUserBalance($userid, $ammount);
$bonus_percent = $this->config->bonus_percent;
$getbonus = ($ammount * (1 + $bonus_percent / 100)) - $ammount;
$this->usersModel->upUserBonuses($userid, $getbonus);
$this->invoicesModel->updateInvoice($invid, array('invoice_status' => 1));
}
break;
case 'error':
responseError("Ошибка,{$params['errorMessage']}"); exit;
break;
default:
responseError("Только: check, pay"); exit;
}
responseSuccess("Успех");
}
}
?>