game/spam.php

74 lines
2.4 KiB
PHP
Raw Permalink Normal View History

2022-06-06 21:30:34 +00:00
<?php
2022-12-19 18:26:14 +00:00
2022-12-30 19:03:37 +00:00
use Core\Db;
2022-12-19 18:26:14 +00:00
const GAME = true;
2022-06-06 21:30:34 +00:00
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
2022-12-19 18:26:14 +00:00
define('IP', UserIp::get());
$u = User::start();
2022-06-06 21:30:34 +00:00
2022-12-19 18:26:14 +00:00
if (isset($_GET['test_login']) || isset($_GET['test_login2'])) {
die();
2022-06-06 21:30:34 +00:00
}
2022-12-19 18:26:14 +00:00
if (isset($_GET['chat'])) {
$sp2 = Db::getRows('select * from chat where spam > 0 order by time desc ');
foreach ($sp2 as $row) {
echo date('d.m.Y H:i', $row['time']) . ' <b>' . $row['login'] . '</b>: ' . $row['text'] . '<hr>';
}
die();
2022-06-06 21:30:34 +00:00
}
2022-12-19 18:26:14 +00:00
if (!$u->info['admin']) {
2023-01-10 16:29:32 +00:00
die('Спамер? :)');
2022-12-19 18:26:14 +00:00
}
2022-06-06 21:30:34 +00:00
?>
2022-12-19 18:26:14 +00:00
<!DOCTYPE HTML>
<html lang="ru">
2022-06-06 21:30:34 +00:00
<head>
2023-01-10 16:29:32 +00:00
<title>Редактирование фильтра от спама</title>
2022-12-19 18:26:14 +00:00
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.1.11.js"></script>
<body style="padding-top:0; margin-top:7px; height:100%; background-color:#dedede;">
2023-01-10 16:29:32 +00:00
<strong>Список запрещенных слов\ссылок:</strong> &nbsp;
<input onClick="location.href='/spam.php';" type="button" value="Обновить"><br><br>
2022-12-19 18:26:14 +00:00
<?php
$spam = Db::getValue('select data from spam_word where id = 1');
$spam = explode('|', $spam);
2022-06-06 21:30:34 +00:00
//
2022-12-19 18:26:14 +00:00
if (isset($_GET['del'])) {
2023-01-10 16:29:32 +00:00
echo '<div style="color: red;">Слово &quot;<b>' . $spam[floor(
2022-12-19 18:26:14 +00:00
(int)$_GET['del']
2023-01-10 16:29:32 +00:00
)] . '</b>&quot; удалено.<br><br></div>';
2022-12-19 18:26:14 +00:00
unset($spam[floor((int)$_GET['del'])]);
$spam = implode('|', $spam);
Db::sql('replace into spam_word set id = 1, data = ?', [$spam]);
$spam = explode('|', $spam);
} elseif (isset($_POST['add'])) {
$_POST['add'] = htmlspecialchars($_POST['add'], null);
2023-01-10 16:29:32 +00:00
echo '<div style="color: green">Слово &quot;<b>' . $_POST['add'] . '</b>&quot; добавлено.<br><br></div>';
2022-12-19 18:26:14 +00:00
$spam = implode('|', $spam);
$spam .= '|' . $_POST['add'];
Db::sql('replace into spam_word set id = 1, data = ?', [$spam]);
$spam = explode('|', $spam);
2022-06-06 21:30:34 +00:00
}
2022-12-19 18:26:14 +00:00
if (is_array($spam)) {
$i = 0;
while ($i < count($spam)) {
echo $spam[$i] . ' <a href="/spam.php?del=' . $i . '"><span style="color: red">x</span></a><hr>';
$i++;
}
2022-06-06 21:30:34 +00:00
}
?>
2022-12-19 18:26:14 +00:00
<form method="post">
<label>
<input type="text" name="add" value="" style="width:244px;">
2023-01-10 16:29:32 +00:00
</label> <input type="submit" value="Добавить">
2022-06-06 21:30:34 +00:00
</form>
</body>
</html>