game/modules_data/moder/useban.php

41 lines
1.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('GAME')) {
die();
}
if ($p['banned'] != 1 && $p['ban0'] != 1) {
$uer = 'У Вас нет прав на использование данного заклятия';
return;
}
$uu = \Core\Db::getRow('select id, login, banned, battle, mail from users where login = ? order by id limit 1', [$_POST['logingo']]);
if (!isset($uu['id'])) {
$uer = 'Персонаж не найден в этом городе';
return;
}
if ($uu['banned'] > 0) {
$uer = 'Персонаж уже заблокирован.';
return;
}
(new \Moderation\Moderation($uu['id']))->ban();
\Core\Db::sql('delete from chat where login = ?', [$uu['login']]);
\Core\Db::sql('insert into ban_email (email, uid, nick_name) values (?,?,?)', [$uu['mail'], $uu['id'], $uu['login']]);
\Core\Db::sql('delete from zayvki where creator = ?', [$uu['id']]); // Удаляем заявки на бой.
\Core\Db::sql('delete from dungeon_zv where uid = ?', [$uu['id']]); // Удаляем заявки в пещеры.
if (!empty($uu['battle'])) {
\Core\Db::sql('update users left join stats on users.id = stats.id set battle = default, regHP = unix_timestamp(), team = 0, battle_yron = 0, battle_exp = 0 where users.id = ?', [$uu['id']]);
}
$uer = "Персонаж {$uu['login']} заблокирован.";
$cmsg = new ChatMessage();
$cmsg->setRoom($u->info['room']);
$cmsg->setText("[img[items/pal_button6.gif]] $uer");
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);