EngineGP/system/engine/control.php
Sergei Solovev 276ec7f3eb Updating the server name reference in code
This change replaces the use of $_SERVER['SERVER_NAME'] with $_SERVER['HTTP_HOST'] throughout the codebase. The modification ensures consistency and compliance with best practices, since $_SERVER['HTTP_HOST'] is often used to extract the host header from an HTTP request. This update may improve compatibility and security, especially in scenarios where the Host header plays a key role in proper server configuration and routing. Please review and test the changes carefully to ensure smooth functionality in different environments.
2023-12-23 04:50:14 +03:00

69 lines
2.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['HTTP_HOST'] . '/404'));
// Проверка на авторизацию
sys::noauth();
$title = 'Список подключенных серверов';
include(LIB . 'control/control.php');
if ($id) {
if ($user['group'] == 'admin')
$sql->query('SELECT `id`, `user`, `status`, `time` FROM `control` WHERE `id`="' . $id . '" LIMIT 1');
else
$sql->query('SELECT `id`, `user`, `status`, `time` FROM `control` WHERE `id`="' . $id . ' AND `user`="' . $user['id'] . '" LIMIT 1');
if (!$sql->num()) {
if ($go)
sys::outjs(array('e' => 'Сервер #' . $id . ' не найден'));
sys::back($cfg['http'] . 'control');
}
$ctrl = $sql->get();
if (in_array($ctrl['status'], array('install', 'overdue', 'blocked', 'reboot')) && !in_array($section, array('extend', 'scan')))
include(SEC . 'control/noaccess.php');
else {
if (!$section)
$section = 'index';
$sid = array_key_exists('server', $url) ? sys::int($url['server']) : false;
if ($sid)
include(SEC . 'control/servers/' . $section . '.php');
else
include(SEC . 'control/' . $section . '.php');
}
} else {
$html->nav($title);
$js = '';
$ctrls = $sql->query('SELECT `id`, `address`, `passwd`, `time`, `date`, `status` FROM `control` WHERE `user`="' . $user['id'] . '"');
while ($ctrl = $sql->get($ctrls)) {
$time_end = $ctrl['status'] == 'overdue' ? 'Удаление через: ' . sys::date('min', $ctrl['overdue'] + $cfg['control_delete'] * 86400) : 'Осталось: ' . sys::date('min', $ctrl['time']);
$btn = ctrl::buttons($ctrl['id'], $ctrl['status']);
$html->get('control', 'sections/control');
$html->set('id', $ctrl['id']);
$html->set('address', $ctrl['address']);
$html->set('passwd', $ctrl['passwd']);
$html->set('time', sys::today($ctrl['time']));
$html->set('date', sys::today($ctrl['date']));
$html->set('time_end', $time_end);
$html->set('status', ctrl::status($ctrl['status']));
$html->set('btn', $btn);
$html->pack('list');
$js .= 'update_resources(' . $ctrl['id'] . ', true);';
}
$html->get('controls', 'sections/control');
$html->set('list', isset($html->arr['list']) ? $html->arr['list'] : 'У вас нет подключенных серверов', true);
$html->set('updates_control', $js);
$html->pack('main');
}
?>