Сборка 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 - документация на русском: ИЗМЕНЕНИЯ, БЕЗОПАСНОСТЬ, ИНСТРУКЦИЯ
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class bonusController extends Controller {
|
||||
public function index() {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('bonus');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 0) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->model('users');
|
||||
$this->data['bonus1'] = $this->config->bonus1;
|
||||
$this->data['bonus2'] = $this->config->bonus2;
|
||||
$this->data['bonus3'] = $this->config->bonus3;
|
||||
$this->data['bonus4'] = $this->config->bonus4;
|
||||
|
||||
$userid = $this->user->getId();
|
||||
$users = $this->usersModel->getUserById($userid, array(), array());
|
||||
$this->data['users'] = $users;
|
||||
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/bonus', $this->data);
|
||||
}
|
||||
public function ajax_action_exchange($action = null) {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->data['bonus1'] = $bonus1 = round($this->config->bonus1);
|
||||
$this->data['bonus2'] = $bonus2 = round($this->config->bonus2);
|
||||
$this->data['bonus3'] = $bonus3 = round($this->config->bonus3);
|
||||
$this->data['bonus4'] = $bonus4 = round($this->config->bonus4);
|
||||
|
||||
$this->load->model('users');
|
||||
$this->load->model('waste');
|
||||
|
||||
$userid = $this->user->getId();
|
||||
$users = $this->usersModel->getUserById($userid, array(), array());
|
||||
|
||||
switch($action) {
|
||||
case '100DEB': {
|
||||
$rmoney = $users['bonuses'];
|
||||
$sum = "100";
|
||||
$upsum = $bonus1;
|
||||
if ($rmoney >= $sum){
|
||||
|
||||
$this->usersModel->downUserBalance($userid, $price);
|
||||
$wasteData = array(
|
||||
'user_id' => $userid,
|
||||
'waste_ammount' => $upsum,
|
||||
'waste_status' => 0,
|
||||
'waste_usluga' => "Обменял $sum бонусов на $upsum рублей"
|
||||
);
|
||||
$this->wasteModel->createWaste($wasteData);
|
||||
|
||||
$this->usersModel->upUserBalance($userid, $upsum);
|
||||
$this->usersModel->downUserBonuses($userid, $sum);
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Деньги отправлены. Вам начисленно ".$upsum." руб!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас недостаточно монет!";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '300DEB': {
|
||||
$rmoney = $users['bonuses'];
|
||||
$sum = "300";
|
||||
$upsum = $bonus2;
|
||||
if ($rmoney >= $sum){
|
||||
|
||||
$this->usersModel->downUserBalance($userid, $price);
|
||||
$wasteData = array(
|
||||
'user_id' => $userid,
|
||||
'waste_ammount' => $upsum,
|
||||
'waste_status' => 0,
|
||||
'waste_usluga' => "Обменял $sum бонусов на $upsum рублей"
|
||||
);
|
||||
$this->wasteModel->createWaste($wasteData);
|
||||
|
||||
$this->usersModel->upUserBalance($userid, $upsum);
|
||||
$this->usersModel->downUserBonuses($userid, $sum);
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Деньги отправлены. Вам начисленно ".$upsum." руб!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас недостаточно монет!";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '600DEB': {
|
||||
$rmoney = $users['bonuses'];
|
||||
$sum = "600";
|
||||
$upsum = $bonus3;
|
||||
if ($rmoney >= $sum){
|
||||
|
||||
$this->usersModel->downUserBalance($userid, $price);
|
||||
$wasteData = array(
|
||||
'user_id' => $userid,
|
||||
'waste_ammount' => $upsum,
|
||||
'waste_status' => 0,
|
||||
'waste_usluga' => "Обменял $sum бонусов на $upsum рублей"
|
||||
);
|
||||
$this->wasteModel->createWaste($wasteData);
|
||||
|
||||
$this->usersModel->upUserBalance($userid, $upsum);
|
||||
$this->usersModel->downUserBonuses($userid, $sum);
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Деньги отправлены. Вам начисленно ".$upsum." руб!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас недостаточно монет!";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '1000DEB': {
|
||||
$rmoney = $users['bonuses'];
|
||||
$sum = "1000";
|
||||
$upsum = $bonus4;
|
||||
if ($rmoney >= $sum){
|
||||
|
||||
$this->usersModel->downUserBalance($userid, $price);
|
||||
$wasteData = array(
|
||||
'user_id' => $userid,
|
||||
'waste_ammount' => $upsum,
|
||||
'waste_status' => 0,
|
||||
'waste_usluga' => "Обменял $sum бонусов на $upsum рублей"
|
||||
);
|
||||
$this->wasteModel->createWaste($wasteData);
|
||||
|
||||
$this->usersModel->upUserBalance($userid, $upsum);
|
||||
$this->usersModel->downUserBonuses($userid, $sum);
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Деньги отправлены. Вам начисленно ".$upsum." руб!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас недостаточно монет!";
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы выбрали несуществующее действие!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class errorController extends Controller {
|
||||
public function index() {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('pay');
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 0) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
$this->load->model('users');
|
||||
$this->load->model('invoices');
|
||||
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/error', $this->data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class invoicesController extends Controller {
|
||||
private $limit = 8;
|
||||
public function index($page = 1) {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('invoices');
|
||||
$this->data['title'] = $this->config->title;
|
||||
$this->data['description'] = $this->config->description;
|
||||
$this->data['mail_from'] = $this->config->mail_from;
|
||||
$this->data['homed'] = $this->config->homed;
|
||||
$this->data['city_country'] = $this->config->city_country;
|
||||
$this->data['phone'] = $this->config->phone;
|
||||
$this->data['logo'] = $this->config->logo;
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 0) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->library('pagination');
|
||||
$this->load->model('invoices');
|
||||
$this->load->model('users');
|
||||
$userid = $this->user->getId();
|
||||
$sort = array(
|
||||
'invoice_status' => 'DESC',
|
||||
'invoice_id' => 'DESC'
|
||||
);
|
||||
$getOptions = array(
|
||||
'start' => ($page - 1) * $this->limit,
|
||||
'limit' => $this->limit
|
||||
);
|
||||
|
||||
$total = $this->invoicesModel->getTotalInvoices(array('user_id' => (int)$userid));
|
||||
$invoices = $this->invoicesModel->getInvoices(array('user_id' => (int)$userid), array(), $sort, $getOptions);
|
||||
|
||||
$paginationLib = new paginationLibrary();
|
||||
|
||||
$paginationLib->total = $total;
|
||||
$paginationLib->page = $page;
|
||||
$paginationLib->limit = $this->limit;
|
||||
$paginationLib->url = $this->config->url . 'account/invoices/index/{page}';
|
||||
|
||||
$pagination = $paginationLib->render();
|
||||
|
||||
$this->data['invoices'] = $invoices;
|
||||
$this->data['pagination'] = $pagination;
|
||||
$this->data['user_email'] = $this->user->getEmail();
|
||||
$this->data['user_id'] = $userid;
|
||||
$this->data['user_firstname'] = $this->user->getFirstname();
|
||||
$this->data['user_lastname'] = $this->user->getLastname();
|
||||
$this->data['user_balance'] = $this->user->getBalance();
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/invoices', $this->data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class loginController extends Controller {
|
||||
private $limit = 6;
|
||||
public function index($page = 1) {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('login');
|
||||
$this->data['recaptcha'] = $this->config->recaptcha;
|
||||
$this->data['captcha_enable'] = $this->config->captcha_enable;
|
||||
|
||||
if($this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
$this->load->library('pagination');
|
||||
$this->load->model('news');
|
||||
$sort = array(
|
||||
//'ticket_status' => 'DESC',
|
||||
'news_date_add' => 'DESC'
|
||||
);
|
||||
|
||||
$options = array(
|
||||
'start' => ($page - 1) * $this->limit,
|
||||
'limit' => $this->limit
|
||||
);
|
||||
|
||||
$total = $this->newsModel->getTotalNews();
|
||||
$tickets = $this->newsModel->getNews(array(), array(), $sort, $options);
|
||||
|
||||
$paginationLib = new paginationLibrary();
|
||||
|
||||
$paginationLib->total = $total;
|
||||
$paginationLib->page = $page;
|
||||
$paginationLib->limit = $this->limit;
|
||||
$paginationLib->url = $this->config->url . '/account/login/index/{page}';
|
||||
|
||||
$pagination = $paginationLib->render();
|
||||
|
||||
$this->data['tickets'] = $tickets;
|
||||
$this->data['pagination'] = $pagination;
|
||||
$this->getChild(array('common/loginheader', 'common/loginfooter'));
|
||||
return $this->load->view('account/login', $this->data);
|
||||
}
|
||||
|
||||
//Авторизация через вк
|
||||
public function vk() {
|
||||
if($this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы уже авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('users');
|
||||
$userid = $this->user->getId();
|
||||
|
||||
if($this->request->post['auth']){
|
||||
$id = $this->request->post['response']['session']['user']['id'];
|
||||
|
||||
if($u = $this->usersModel->getUserByUser_vk_id($id, "user_vk_id")){
|
||||
if($u['user_activate'] != '1'){
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данный аккаунт не активирован!";
|
||||
return json_encode($this->data);
|
||||
} else {
|
||||
if($this->user->loginVk($id)) {
|
||||
$ip=$this->user->getRealIpAdress();
|
||||
$this->usersModel->createAuthLog($u['user_id'],$ip,'1','Auth for VK');
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Вы успешно авторизировались!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Неизвестная ошибка!";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->session->data['auth_vk'] = $id;
|
||||
$this->data['status'] = "auth_error";
|
||||
$this->data['auth_error'] = "Внутренняя ошибка!(Либо не привязана учётка)";
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
if($this->request->post['auth_vk']) {
|
||||
if($user = @file_get_contents("https://api.vk.com/method/users.get?uids={$this->session->data['auth_vk']}&fields=uid,first_name,last_name,email,screen_name,sex,bdate,photo_big"))
|
||||
$this->data['user'] = json_decode($user, true);
|
||||
$email = @$this->request->post['email'];
|
||||
$password = @$this->request->post['password'];
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function ajax() {
|
||||
$this->load->model('users');
|
||||
if($this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$email = @$this->request->post['email'];
|
||||
$password = @$this->request->post['password'];
|
||||
|
||||
$user = @$this->usersModel->getUserByEmail($email);
|
||||
if($user and $user['user_activate'] !== '1'){
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данный аккаунт не активирован!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->login($email, md5($password))) {
|
||||
$userid=$this->usersModel->getIdByEmail($email);
|
||||
$ip=$this->user->getRealIpAdress();
|
||||
$this->usersModel->createAuthLog($userid['user_id'],$ip,'1','');
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Вы успешно вошли!";
|
||||
} else {
|
||||
|
||||
$userid=$this->usersModel->getIdByEmail($email);
|
||||
$ip=$this->user->getRealIpAdress();
|
||||
$this->usersModel->createAuthLog($userid['user_id'],$ip,'0','');
|
||||
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы ввели не верный логин или пароль!";
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
|
||||
}else{
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Не POST запрос";
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function activate()
|
||||
{
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('activate');
|
||||
|
||||
if ($this->user->isLogged()) {
|
||||
$this->session->data['error'] = 'Вы уже авторизированы!';
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->model('users');
|
||||
$this->data['title'] = $this->config->title;
|
||||
$key = @$this->request->get['key'];
|
||||
$user = @$this->usersModel->getUserByKey($key);
|
||||
if ($key && $user && ($user['user_activate'] == 0)) {
|
||||
$this->usersModel->updateUser($user['user_id'], array('user_activate' => 1, 'key_activate' => 0));
|
||||
$this->data['user'] = $user;
|
||||
}
|
||||
|
||||
$this->getChild(array('common/loginheader', 'common/loginfooter'));
|
||||
return $this->load->view('account/activate', $this->data);
|
||||
}
|
||||
|
||||
public function complete()
|
||||
{
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('activate');
|
||||
|
||||
if ($this->user->isLogged()) {
|
||||
$this->session->data['error'] = 'Вы уже авторизированы!';
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->model('users');
|
||||
$this->data['title'] = $this->config->title;
|
||||
|
||||
$this->getChild(array('common/loginheader', 'common/loginfooter'));
|
||||
return $this->load->view('account/complete', $this->data);
|
||||
}
|
||||
|
||||
private function validatePOST() {
|
||||
|
||||
$this->load->library('validate');
|
||||
|
||||
$validateLib = new validateLibrary();
|
||||
|
||||
$result = null;
|
||||
|
||||
$email = @$this->request->post['email'];
|
||||
$password = @$this->request->post['password'];
|
||||
$recaptcha = @$this->request->post['g-recaptcha-response'];
|
||||
|
||||
if(!$validateLib->email($email)) {
|
||||
$result = "Укажите свой реальный E-Mail!";
|
||||
}
|
||||
elseif(!$validateLib->password($password)) {
|
||||
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
|
||||
}
|
||||
if($this->config->captcha_enable != '1') return $result;
|
||||
if(!$recaptcha) return 'Подтвердите, что вы не робот!';
|
||||
$url = 'https://www.google.com/recaptcha/api/siteverify';
|
||||
$data = array('secret' => $this->config->secret_recaptcha, 'response' => $recaptcha);
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'remoteip' => 'remoteip',
|
||||
'content' => http_build_query($data),
|
||||
)
|
||||
);
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$recaptcha_get = json_decode(file_get_contents($url, false, $context))->{'success'};
|
||||
if($recaptcha_get != '1') return 'Проверьте правильность капчи!';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class logoutController extends Controller {
|
||||
public function index() {
|
||||
$this->load->model('users');
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('logout');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = 'Вы не авторизированы';
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
|
||||
$userid=$this->user->getId();
|
||||
$ip=$this->user->getRealIpAdress();
|
||||
$this->usersModel->createAuthLog($userid,$ip,'2','NONE');
|
||||
|
||||
$this->user->logout();
|
||||
$this->session->data['success'] = 'Вы успешно вышли из своего аккаунта';
|
||||
$this->response->redirect($this->config->url);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,564 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class payController extends Controller {
|
||||
public function index() {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('pay');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 0) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
$this->load->model('users');
|
||||
$unitpay = $this->config->unitpay;
|
||||
$enotpay = $this->config->enotpay;
|
||||
$anypay = $this->config->anypay;
|
||||
$litekassa = $this->config->litekassa;
|
||||
$robokassa = $this->config->robokassa;
|
||||
$freekassa = $this->config->freekassa;
|
||||
$interkassa = $this->config->interkassa;
|
||||
$yandexkassa = $this->config->yandexkassa;
|
||||
$qiwi = $this->config->qiwi;
|
||||
$this->data['unitpay'] = $unitpay;
|
||||
$this->data['enotpay'] = $enotpay;
|
||||
$this->data['anypay'] = $anypay;
|
||||
$this->data['litekassa'] = $litekassa;
|
||||
$this->data['robokassa'] = $robokassa;
|
||||
$this->data['freekassa'] = $freekassa;
|
||||
$this->data['interkassa'] = $interkassa;
|
||||
$this->data['yandexkassa'] = $yandexkassa;
|
||||
$this->data['qiwi'] = $qiwi;
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/pay', $this->data);
|
||||
}
|
||||
|
||||
public function anypay() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->anypay == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$server = $this->config->anypay_server;
|
||||
$login = $this->config->anypay_login;
|
||||
$password = $this->config->anypay_password;
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Anypay"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
$currency = 'RUB'; // валюта Вашего магазина
|
||||
$signature = md5("$currency:$ammount:$password:$login:$invid");
|
||||
|
||||
$url = "$server";
|
||||
/* Параметры: */
|
||||
$url .= "?merchant_id=$login";
|
||||
$url .= "&amount=$ammount";
|
||||
$url .= "&sign=$signature";
|
||||
$url .= "&desc=Оплата счета ".$invid;
|
||||
$url .= "&pay_id=$invid";
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function enotpay() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->enotpay == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$server = $this->config->enot_server;
|
||||
$login = $this->config->enot_login;
|
||||
$password1 = $this->config->enot_password1;
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Enot"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
|
||||
$signature = md5("$login:$ammount:$password1:$invid");
|
||||
|
||||
$url = "$server";
|
||||
/* Параметры: */
|
||||
$url .= "?m=$login";
|
||||
$url .= "&oa=$ammount";
|
||||
$url .= "&s=$signature";
|
||||
$url .= "&o=$invid";
|
||||
$url .= "&c=Оплата счета ".$invid;
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function interpay() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->interkassa == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Interkassa"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
$url = "https://sci.interkassa.com/";
|
||||
/* Параметры: */
|
||||
$url .= "?ik_co_id=57e931c53d1eafce4e8b456d";
|
||||
$url .= "&ik_pm_no=$invid";
|
||||
$url .= "&ik_am=$ammount";
|
||||
$url .= "&ik_cur=RUB";
|
||||
$url .= "&ik_desc=Оплата счета ".$invid;
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function robopay() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->robokassa == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$server = $this->config->rk_server;
|
||||
$login = $this->config->rk_login;
|
||||
$password1 = $this->config->rk_password1;
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Robokassa"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
|
||||
$signature = md5("$login:$ammount:$invid:$password1");
|
||||
|
||||
$url = "$server/Index.aspx";
|
||||
/* Параметры: */
|
||||
$url .= "?MrchLogin=$login";
|
||||
$url .= "&OutSum=$ammount";
|
||||
$url .= "&InvId=$invid";
|
||||
$url .= "&SignatureValue=$signature";
|
||||
$url .= "&Desc=Оплата счета ".$invid;
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function freepay() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->freekassa == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$server = $this->config->fk_server;
|
||||
$login = $this->config->fk_login;
|
||||
$password1 = $this->config->fk_password1;
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Free-Kassa"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
|
||||
$signature = md5("$login:$ammount:$invid:$password1");
|
||||
|
||||
$url = "$server/Index.aspx";
|
||||
/* Параметры: */
|
||||
$url .= "?MrchLogin=$login";
|
||||
$url .= "&OutSum=$ammount";
|
||||
$url .= "&InvId=$invid";
|
||||
$url .= "&SignatureValue=$signature";
|
||||
$url .= "&Desc=Оплата счета ".$invid;
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function unitpay() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->unitpay == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Unitpay"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
|
||||
$server = $this->config->unitpay_url;
|
||||
$url = "$server";
|
||||
/* Параметры: */
|
||||
$url .= "?sum=$ammount";
|
||||
$url .= "&account=$invid";
|
||||
$url .= "&desc=Оплата счета ".$invid;
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function yandexkassa() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
$userid = $this->user->getId();
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->yandexkassa == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Yandex Kassa"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
|
||||
$url = "https://money.yandex.ru/quickpay/confirm.xml";
|
||||
$url .= "?receiver=".$this->config->yk_login."";
|
||||
$url .= "&quickpay-form=shop";
|
||||
$url .= "&paymentType=PC";
|
||||
$url .= "&paymentType=AC";
|
||||
$url .= "&paymentType=MC";
|
||||
$url .= "&label=$invid";
|
||||
$url .= "&successURL=".$this->config->url."account/success";
|
||||
$url .= "&targets=Оплата счета ".$invid;
|
||||
$url .= "&sum=$ammount";
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function litepay() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->litekassa == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$server = $this->config->lk_server;
|
||||
$login = $this->config->lk_login;
|
||||
$password = $this->config->lk_password;
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Lite-Kassa"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
|
||||
$signature = md5("$login:$ammount:$password:$invid");
|
||||
|
||||
$url = "$server";
|
||||
/* Параметры: */
|
||||
$url .= "?shop=$login";
|
||||
$url .= "&amount=$ammount";
|
||||
$url .= "&order=$invid";
|
||||
$url .= "&sign=$signature";
|
||||
$url .= "&desc=Оплата счета ".$invid;
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = $url;
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function qiwi() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('invoices');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->config->qiwi == 1) {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$invoiceData = array(
|
||||
'user_id' => $userid,
|
||||
'invoice_ammount' => $ammount,
|
||||
'invoice_status' => 0,
|
||||
'system' => "Qiwi Kassa"
|
||||
);
|
||||
$invid = $this->invoicesModel->createInvoice($invoiceData);
|
||||
|
||||
$params['publicKey'] = $this->config->qiwipublickey;
|
||||
$params['amount'] = number_format(round(floatval($ammount), 2, PHP_ROUND_HALF_DOWN), 2, '.', '');
|
||||
$params['billId'] = $invid;
|
||||
$params['account'] = $userid;
|
||||
$params['comment'] = "Оплата счета ".$invid;
|
||||
$params['successUrl'] = $this->config->url."account/success";
|
||||
if($this->config->qiwi_theme == 1) {
|
||||
$customFields = ['themeCode' => $this->config->qiwi_themecode];
|
||||
$params['customFields'] = $customFields;
|
||||
}
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['url'] = "https://oplata.qiwi.com/create?".http_build_query($params, '', '&', PHP_QUERY_RFC3986);
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Данная платежная система отключена!";
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
private function validatePOST() {
|
||||
|
||||
$this->load->library('validate');
|
||||
|
||||
$validateLib = new validateLibrary();
|
||||
|
||||
$result = null;
|
||||
|
||||
$ammount = @$this->request->post['ammount'];
|
||||
if(!$validateLib->money($ammount)) {
|
||||
$result = "Укажите сумму пополнения в допустимом формате!";
|
||||
}
|
||||
elseif(10 > $ammount || $ammount > 5000) {
|
||||
$result = "Укажите сумму от 10 до 5000 рублей!";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class perevodController extends Controller {
|
||||
public function index() {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('perevod');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 0) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/perevod', $this->data);
|
||||
}
|
||||
|
||||
public function ajax() {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->data['userid'] = $userid = $this->user->getId();
|
||||
|
||||
$this->load->model('users');
|
||||
$this->load->model('waste');
|
||||
|
||||
$users = $this->usersModel->getUserById($userid, array(), array());
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
$errorPOST = $this->validate_POST();
|
||||
if(!$errorPOST) {
|
||||
$id = @$this->request->post['userid'];
|
||||
$sum = @$this->request->post['sum'];
|
||||
$balance = $users['user_balance'];
|
||||
|
||||
if ($balance >= $sum){
|
||||
if ($userid == $id){
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы указали свой ID";
|
||||
} else {
|
||||
$wasteData = array(
|
||||
'user_id' => $userid,
|
||||
'waste_ammount' => $sum,
|
||||
'waste_status' => 1,
|
||||
'waste_usluga' => "Перевод средств пользователю ID-".$id."",
|
||||
);
|
||||
$this->wasteModel->createWaste($wasteData);
|
||||
$this->usersModel->upUserBalance($id, $sum);
|
||||
$this->usersModel->downUserBalance($userid, $sum);
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Средства переведены!";
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас недостаточно средств!";
|
||||
}
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
private function validate_POST() {
|
||||
$this->load->library('validate');
|
||||
|
||||
$validateLib = new validateLibrary();
|
||||
|
||||
$result = null;
|
||||
|
||||
$id = @$this->request->post['userid'];
|
||||
$sum = @$this->request->post['sum'];
|
||||
|
||||
|
||||
if(!$validateLib->money($sum)) {
|
||||
$result = "Укажите реальное число!";
|
||||
}
|
||||
elseif(!$this->usersModel->getTotalUsers(array('user_id' => $id))) {
|
||||
$result = "Данного ID не сушествует!";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class restoreController extends Controller {
|
||||
public function index() {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('restore');
|
||||
$this->data['recaptcha'] = $this->config->recaptcha;
|
||||
|
||||
if($this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы уже авторизированы!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/restore/index', $this->data);
|
||||
}
|
||||
|
||||
public function complete($userid = null, $restoreKey = null) {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('restore');
|
||||
|
||||
if($this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы уже авторизированы!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->model('users');
|
||||
$this->load->library('mail');
|
||||
|
||||
$error = $this->validate($userid, $restoreKey);
|
||||
if($error) {
|
||||
$this->session->data['error'] = $error;
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$user = $this->usersModel->getUserById($userid);
|
||||
|
||||
$chars="qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP";
|
||||
$max=12;
|
||||
$size=StrLen($chars)-1;
|
||||
$password=null;
|
||||
while($max--)
|
||||
$password.=$chars[rand(0,$size)];
|
||||
|
||||
$mailLib = new mailLibrary();
|
||||
|
||||
$mailLib->setFrom($this->config->mail_from);
|
||||
$mailLib->setSender($this->config->mail_sender);
|
||||
$mailLib->setTo($user['user_email']);
|
||||
$mailLib->setSubject('Новый пароль');
|
||||
|
||||
$mailData = array();
|
||||
|
||||
$mailData['firstname'] = $user['user_firstname'];
|
||||
$mailData['lastname'] = $user['user_lastname'];
|
||||
$mailData['email'] = $user['user_email'];
|
||||
$mailData['password'] = $password;
|
||||
|
||||
$text = $this->load->view('mail/account/newpassword', $mailData);
|
||||
|
||||
$mailLib->setText($text);
|
||||
|
||||
$mailLib->send();
|
||||
|
||||
$this->usersModel->updateUser($userid, array('user_password' => md5($password), 'user_restore_key' => null));
|
||||
$this->data['password'] = $password;
|
||||
|
||||
$this->getChild(array('common/loginheader', 'common/loginfooter'));
|
||||
return $this->load->view('account/restore/complete', $this->data);
|
||||
}
|
||||
|
||||
public function ajax() {
|
||||
if($this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы уже авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->library('mail');
|
||||
|
||||
$this->load->model('users');
|
||||
|
||||
$ip=$this->user->getRealIpAdress();
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$email = @$this->request->post['email'];
|
||||
|
||||
$user = $this->usersModel->getUserByEmail($email);
|
||||
|
||||
$restoreKey = md5(microtime());
|
||||
$this->usersModel->updateUser($user['user_id'], array('user_restore_key' => $restoreKey));
|
||||
|
||||
$mailLib = new mailLibrary();
|
||||
|
||||
$mailLib->setFrom($this->config->mail_from);
|
||||
$mailLib->setSender($this->config->mail_sender);
|
||||
$mailLib->setTo($user['user_email']);
|
||||
$mailLib->setSubject('Восстановление пароля');
|
||||
|
||||
$mailData = array();
|
||||
|
||||
$mailData['firstname'] = $user['user_firstname'];
|
||||
$mailData['lastname'] = $user['user_lastname'];
|
||||
$mailData['email'] = $user['user_email'];
|
||||
$mailData['ip'] = $ip;
|
||||
$mailData['restorelink'] = "".$this->config->url."account/restore/complete/".$user['user_id']."/".$restoreKey."";
|
||||
|
||||
$text = $this->load->view('mail/account/restore', $mailData);
|
||||
|
||||
$mailLib->setText($text);
|
||||
|
||||
$mailLib->send();
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "На ваш E-Mail отправлена информация для восстановления пароля!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
private function validate($userid, $restoreKey) {
|
||||
$this->load->library('validate');
|
||||
|
||||
$validateLib = new validateLibrary();
|
||||
|
||||
$result = null;
|
||||
|
||||
if(!$validateLib->md5($restoreKey) || !$this->usersModel->getTotalUsers(array('user_id' => (int)$userid, 'user_restore_key' => $restoreKey))) {
|
||||
$result = "Указанный ключ восстановления неверный!";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function validatePOST() {
|
||||
$this->load->library('validate');
|
||||
|
||||
$validateLib = new validateLibrary();
|
||||
|
||||
$result = null;
|
||||
|
||||
$email = @$this->request->post['email'];
|
||||
$recaptcha = @$this->request->post['g-recaptcha-response'];
|
||||
|
||||
if(!$validateLib->email($email)) {
|
||||
$result = "Укажите свой реальный E-Mail!";
|
||||
}
|
||||
elseif($captcha != $captchahash) {
|
||||
$result = "Укажите правильный код с картинки!";
|
||||
}
|
||||
elseif($this->usersModel->getTotalUsers(array('user_email' => $email)) < 1) {
|
||||
$result = "Пользователь с указанным E-Mail не зарегистрирован!";
|
||||
}
|
||||
if(!$recaptcha) return 'Подтвердите, что вы не робот!';
|
||||
$url = 'https://www.google.com/recaptcha/api/siteverify';
|
||||
$data = array('secret' => $this->config->secret_recaptcha, 'response' => $recaptcha);
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'remoteip' => 'remoteip',
|
||||
'content' => http_build_query($data),
|
||||
)
|
||||
);
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$recaptcha_get = json_decode(file_get_contents($url, false, $context))->{'success'};
|
||||
if($recaptcha_get != '1') return 'Проверьте правильность капчи!';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class successController extends Controller {
|
||||
public function index() {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('pay');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 0) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
|
||||
if($this->config->interkassa == 1) {
|
||||
$this->load->model('users');
|
||||
$this->load->model('invoices');
|
||||
$this->load->model('waste');
|
||||
|
||||
$secret_key = $this->config->ik_secretkey;
|
||||
$ik_shop_id = $this->config->ik_shopid;
|
||||
|
||||
$err[1] = 'Ошибка - Неверная сумма платежа!';
|
||||
$err[2] = 'Ошибка - Shop ID!';
|
||||
$err[3] = 'Ошибка - Не верный ID платежа!';
|
||||
$err[3] = 'Ошибка - Данный счет уже оплачен!';
|
||||
|
||||
//Получение информации о платеже от системы Interkassa
|
||||
$post_shop_id = trim(stripslashes($_POST['ik_co_id'])); //Номер сайта продавца (eshopId);
|
||||
$ik_payment_amount = trim(stripslashes($_POST['ik_payment_amount'])); //Сумма платежа (recipientAmount);
|
||||
$ik_payment_id = trim(stripslashes($_POST['ik_payment_id'])); //Идентификатор платежа
|
||||
$ik_pm_no = trim(stripslashes($_POST['ik_pm_no'])); //id
|
||||
$ik_am = trim(stripslashes($_POST['ik_am'])); //im
|
||||
$ik_paysystem_alias = trim(stripslashes($_POST['ik_paysystem_alias'])); //Способ оплаты
|
||||
$ik_baggage_fields = trim(stripslashes($_POST['ik_baggage_fields'])); //пользовательское поле
|
||||
$ik_payment_state = trim(stripslashes($_POST['ik_payment_state'])); //Статус платежа (paymentStatus);
|
||||
$ik_trans_id = trim(stripslashes($_POST['ik_trans_id'])); //внутренний номер платежа
|
||||
$ik_currency_exch = trim(stripslashes($_POST['ik_currency_exch'])); //Валюта платежа (recipientCurrency);
|
||||
$ik_fees_payer = trim(stripslashes($_POST['ik_fees_payer'])); //плательщик комиссии
|
||||
|
||||
$sing_hash_str = $ik_shop_id.':'.
|
||||
$ik_payment_amount.':'.
|
||||
$ik_payment_id.':'.
|
||||
$ik_paysystem_alias.':'.
|
||||
$ik_baggage_fields.':'.
|
||||
$ik_payment_state.':'.
|
||||
$ik_trans_id.':'.
|
||||
$ik_currency_exch.':'.
|
||||
$ik_fees_payer.':'.$secret_key;
|
||||
|
||||
|
||||
$userid = $this->user->getId();
|
||||
$invoice = $this->invoicesModel->getInvoiceById($ik_pm_no);
|
||||
|
||||
if($invoice['invoice_ammount'] == $ik_am) {
|
||||
if($post_shop_id == $ik_shop_id) {
|
||||
if($invoice['invoice_id'] == $ik_pm_no){
|
||||
if($invoice['invoice_status'] == 0) {
|
||||
$this->usersModel->upUserBalance($userid, $ik_am);
|
||||
$this->invoicesModel->updateInvoice($ik_pm_no, array('invoice_status' => 1));
|
||||
|
||||
$userid = $invoice['user_id'];
|
||||
$user = $this->usersModel->getUserById($userid);
|
||||
|
||||
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);
|
||||
} else {
|
||||
$this->response->redirect($this->config->url . 'account/error');
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $err[4];
|
||||
}
|
||||
} else {
|
||||
$this->response->redirect($this->config->url . 'account/error');
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $err[3];
|
||||
}
|
||||
} else {
|
||||
$this->response->redirect($this->config->url . 'account/error');
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $err[2];
|
||||
}
|
||||
} else {
|
||||
$this->response->redirect($this->config->url . 'account/error');
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $err[1];
|
||||
}
|
||||
}
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/success', $this->data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class wasteController extends Controller {
|
||||
private $limit = 20;
|
||||
public function index($page = 1) {
|
||||
$this->document->setActiveSection('account');
|
||||
$this->document->setActiveItem('waste');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 1) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->library('pagination');
|
||||
$this->load->model('waste');
|
||||
|
||||
$pl = array(
|
||||
'start' => ($page - 1) * $this->limit,
|
||||
);
|
||||
$userid = $this->user->getId();
|
||||
$total = $this->wasteModel->getTotalWaste(array('user_id' => (int)$userid));
|
||||
$waste = $this->wasteModel->getWaste(array('user_id' => (int)$userid), array(), array(), $pl);
|
||||
|
||||
|
||||
$paginationLib = new paginationLibrary();
|
||||
|
||||
$paginationLib->total = $total;
|
||||
$paginationLib->page = $page;
|
||||
$paginationLib->limit = $this->limit;
|
||||
$paginationLib->url = $this->config->url . 'account/waste/index/{page}';
|
||||
|
||||
$pagination = $paginationLib->render();
|
||||
|
||||
$this->data['waste'] = $waste;
|
||||
$this->data['pagination'] = $pagination;
|
||||
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('account/waste', $this->data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user