EngineGP/system/acp/sections/logs/search.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

74 lines
2.6 KiB
PHP

<?php
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['HTTP_HOST'] . '/404'));
$text = isset($_POST['text']) ? trim($_POST['text']) : '';
$mkey = md5($text . $id);
$cache = $mcache->get($mkey);
if (is_array($cache)) {
if ($go)
sys::outjs($cache, $nmch);
sys::outjs($cache);
}
if (!isset($text[2])) {
if ($go)
sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
sys::outjs(array('e' => ''));
}
$select = '`id`, `user`, `text`, `date`, `type`, `money` FROM `logs`';
$check = explode('=', $text);
if (in_array($check[0], array('server', 'user'))) {
$val = trim($check[1]);
switch ($check[0]) {
case 'server':
$sql->query('SELECT ' . $select . ' WHERE `server`="' . sys::int($val) . '" ORDER BY `id` DESC');
break;
case 'user':
$sql->query('SELECT ' . $select . ' WHERE `user`="' . sys::int($val) . '" ORDER BY `id` DESC');
}
} elseif ($text[0] == 'i' and $text[1] == 'd')
$sql->query('SELECT `id`, `user`, `text`, `date`, `type`, `money` FROM `logs` WHERE `id`="' . sys::int($text) . '" LIMIT 1');
else {
$like = '`id` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
. '`user` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
. '`type` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
. '`money` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
. '`text` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\')';
$sql->query('SELECT ' . $select . ' WHERE ' . $like . ' ORDER BY `id` DESC LIMIT 40');
}
if (!$sql->num()) {
if ($go)
sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
}
$list = '';
while ($log = $sql->get()) {
$list .= '<tr>';
$list .= '<td>' . $log['id'] . '</td>';
$list .= '<td>' . $log['text'] . '</td>';
$list .= '<td class="text-center"><a href="' . $cfg['http'] . 'acp/users/id/' . $log['user'] . '">USER_' . $log['user'] . '</a></td>';
$list .= '<td class="text-center">' . $log['money'] . ' ' . $cur['currency'] . '</td>';
$list .= '<td class="text-center">' . date('d.m.Y - H:i:s', $log['date']) . '</td>';
$list .= '</tr>';
}
$mcache->set($mkey, array('s' => $list), false, 15);
sys::outjs(array('s' => $list));
?>