Сборка 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,110 @@
|
||||
<?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 createController extends Controller {
|
||||
public function index() {
|
||||
$this->document->setActiveSection('admin/locations');
|
||||
$this->document->setActiveItem('create');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 3) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->getChild(array('common/admheader', 'common/footer'));
|
||||
return $this->load->view('admin/locations/create', $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() < 3) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('locations');
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$name = @$this->request->post['name'];
|
||||
$ip = @$this->request->post['ip'];
|
||||
$ip2 = @$this->request->post['ip2'];
|
||||
$user = @$this->request->post['user'];
|
||||
$password = @$this->request->post['password'];
|
||||
$password2 = @$this->request->post['password2'];
|
||||
$status = @$this->request->post['status'];
|
||||
|
||||
$locationData = array(
|
||||
'location_name' => $name,
|
||||
'location_ip' => $ip,
|
||||
'location_ip2' => $ip2,
|
||||
'location_user' => $user,
|
||||
'location_password' => $password,
|
||||
'location_status' => (int)$status
|
||||
);
|
||||
|
||||
$this->locationsModel->createLocation($locationData);
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Вы успешно создали локацию!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
private function validatePOST() {
|
||||
$this->load->library('validate');
|
||||
|
||||
$validateLib = new validateLibrary();
|
||||
|
||||
$result = null;
|
||||
|
||||
$name = @$this->request->post['name'];
|
||||
$ip = @$this->request->post['ip'];
|
||||
$ip2 = @$this->request->post['ip2'];
|
||||
$user = @$this->request->post['user'];
|
||||
$password = @$this->request->post['password'];
|
||||
$password2 = @$this->request->post['password2'];
|
||||
$status = @$this->request->post['status'];
|
||||
|
||||
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
|
||||
$result = "Название локации должно содержать от 2 до 32 символов!";
|
||||
}
|
||||
elseif(!$validateLib->ip($ip)) {
|
||||
$result = "Укажите допустимый IP!";
|
||||
}
|
||||
elseif(!$validateLib->ip($ip2)) {
|
||||
$result = "Укажите допустимый IP!";
|
||||
}
|
||||
elseif(mb_strlen($user) < 2 || mb_strlen($user) > 32) {
|
||||
$result = "Имя пользователя должно содержать от 2 до 32 символов!";
|
||||
}
|
||||
elseif(!$validateLib->password($password)) {
|
||||
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
|
||||
}
|
||||
elseif($password != $password2) {
|
||||
$result = "Введенные вами пароли не совпадают!";
|
||||
}
|
||||
elseif($status < 0 || $status > 1) {
|
||||
$result = "Укажите допустимый статус!";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,171 @@
|
||||
<?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 editController extends Controller {
|
||||
public function index($locationid = null) {
|
||||
$this->document->setActiveSection('admin/locations');
|
||||
$this->document->setActiveItem('create');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 3) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->model('locations');
|
||||
|
||||
$error = $this->validate($locationid);
|
||||
if($error) {
|
||||
$this->session->data['error'] = $error;
|
||||
$this->response->redirect($this->config->url . 'admin/locations/index');
|
||||
}
|
||||
|
||||
$location = $this->locationsModel->getLocationById($locationid);
|
||||
|
||||
$this->data['location'] = $location;
|
||||
|
||||
$this->getChild(array('common/admheader', 'common/footer'));
|
||||
return $this->load->view('admin/locations/edit', $this->data);
|
||||
}
|
||||
|
||||
public function ajax($locationid = null) {
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "Вы не авторизированы!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
if($this->user->getAccessLevel() < 3) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
$this->load->model('locations');
|
||||
|
||||
$error = $this->validate($locationid);
|
||||
if($error) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $error;
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
$errorPOST = $this->validatePOST();
|
||||
if(!$errorPOST) {
|
||||
$name = @$this->request->post['name'];
|
||||
$ip = @$this->request->post['ip'];
|
||||
$ip2 = @$this->request->post['ip2'];
|
||||
$user = @$this->request->post['user'];
|
||||
$password = @$this->request->post['password'];
|
||||
$password2 = @$this->request->post['password2'];
|
||||
$editpassword = @$this->request->post['editpassword'];
|
||||
$status = @$this->request->post['status'];
|
||||
$location_games = @$this->request->post['location_games'];
|
||||
|
||||
$locationData = array(
|
||||
'location_name' => $name,
|
||||
'location_ip' => $ip,
|
||||
'location_ip2' => $ip2,
|
||||
'location_user' => $user,
|
||||
'location_status' => (int)$status,
|
||||
'location_games' => $location_games
|
||||
);
|
||||
|
||||
if($editpassword) {
|
||||
$locationData['location_password'] = $password;
|
||||
}
|
||||
|
||||
$this->locationsModel->updateLocation($locationid, $locationData);
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Вы успешно отредактировали локацию!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
public function delete($locationid = null) {
|
||||
$this->document->setActiveSection('admin');
|
||||
$this->document->setActiveItem('locations');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 3) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->model('locations');
|
||||
|
||||
$error = $this->validate($locationid);
|
||||
if($error) {
|
||||
$this->session->data['error'] = $error;
|
||||
$this->response->redirect($this->config->url . 'admin/locations/index');
|
||||
}
|
||||
|
||||
$this->locationsModel->deleteLocation($locationid);
|
||||
|
||||
$this->session->data['success'] = "Вы успешно удалили локацию!";
|
||||
$this->response->redirect($this->config->url . 'admin/locations/index');
|
||||
return null;
|
||||
}
|
||||
|
||||
private function validate($locationid) {
|
||||
$result = null;
|
||||
|
||||
if(!$this->locationsModel->getTotalLocations(array('location_id' => (int)$locationid))) {
|
||||
$result = "Запрашиваемая локация не существует!";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function validatePOST() {
|
||||
$this->load->library('validate');
|
||||
|
||||
$validateLib = new validateLibrary();
|
||||
|
||||
$result = null;
|
||||
|
||||
$name = @$this->request->post['name'];
|
||||
$ip = @$this->request->post['ip'];
|
||||
$user = @$this->request->post['user'];
|
||||
$editpassword = @$this->request->post['editpassword'];
|
||||
$password = @$this->request->post['password'];
|
||||
$password2 = @$this->request->post['password2'];
|
||||
$status = @$this->request->post['status'];
|
||||
|
||||
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
|
||||
$result = "Название локации должно содержать от 2 до 32 символов!";
|
||||
}
|
||||
elseif(!$validateLib->ip($ip)) {
|
||||
$result = "Укажите допустимый IP!";
|
||||
}
|
||||
elseif(mb_strlen($user) < 2 || mb_strlen($user) > 32) {
|
||||
$result = "Имя пользователя должно содержать от 2 до 32 символов!";
|
||||
}
|
||||
elseif($editpassword) {
|
||||
if(!$validateLib->password($password)) {
|
||||
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
|
||||
}
|
||||
elseif($password != $password2) {
|
||||
$result = "Введенные вами пароли не совпадают!";
|
||||
}
|
||||
}
|
||||
elseif($status < 0 || $status > 1) {
|
||||
$result = "Укажите допустимый статус!";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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 indexController extends Controller {
|
||||
private $limit = 20;
|
||||
public function index($page = 1) {
|
||||
$this->document->setActiveSection('admin/locations');
|
||||
$this->document->setActiveItem('index');
|
||||
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->session->data['error'] = "Вы не авторизированы!";
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 3) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->library('pagination');
|
||||
$this->load->model('locations');
|
||||
|
||||
$options = array(
|
||||
'start' => ($page - 1) * $this->limit,
|
||||
'limit' => $this->limit
|
||||
);
|
||||
|
||||
$total = $this->locationsModel->getTotalLocations();
|
||||
$locations = $this->locationsModel->getLocations(array(), array(), $options);
|
||||
|
||||
$paginationUrl = '/admin/locations/index/index/{page}';
|
||||
$paginationLib = new paginationLibrary();
|
||||
$paginationLib->total = $total;
|
||||
$paginationLib->page = $page;
|
||||
$paginationLib->limit = $this->limit;
|
||||
$paginationLib->url = $paginationUrl;
|
||||
$pagination = $paginationLib->render();
|
||||
|
||||
$this->data['locations'] = $locations;
|
||||
$this->data['pagination'] = $pagination;
|
||||
|
||||
$this->getChild(array('common/admheader', 'common/footer'));
|
||||
return $this->load->view('admin/locations/index', $this->data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user