game/spam.php
2022-12-19 20:26:14 +02:00

74 lines
2.4 KiB
PHP

<?php
use Insallah\Db;
const GAME = true;
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
define('IP', UserIp::get());
$u = User::start();
if (isset($_GET['test_login']) || isset($_GET['test_login2'])) {
die();
}
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();
}
if (!$u->info['admin']) {
die('Ñïàìåð? :)');
}
?>
<!DOCTYPE HTML>
<html lang="ru">
<head>
<title>Ðåäàêòèðîâàíèå ôèëüòðà îò ñïàìà</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
<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;">
<strong>Ñïèñîê çàïðåùåííûõ ñëîâ\ññûëîê:</strong> &nbsp;
<input onClick="location.href='/spam.php';" type="button" value="Îáíîâèòü"><br><br>
<?php
$spam = Db::getValue('select data from spam_word where id = 1');
$spam = explode('|', $spam);
//
if (isset($_GET['del'])) {
echo '<div style="color: red;">Ñëîâî &quot;<b>' . $spam[floor(
(int)$_GET['del']
)] . '</b>&quot; óäàëåíî.<br><br></div>';
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, 'cp1251');
echo '<div style="color: green">Ñëîâî &quot;<b>' . $_POST['add'] . '</b>&quot; äîáàâëåíî.<br><br></div>';
$spam = implode('|', $spam);
$spam .= '|' . $_POST['add'];
Db::sql('replace into spam_word set id = 1, data = ?', [$spam]);
$spam = explode('|', $spam);
}
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++;
}
}
?>
<form method="post">
<label>
<input type="text" name="add" value="" style="width:244px;">
</label> <input type="submit" value="Äîáàâèòü">
</form>
</body>
</html>