game/_incl_data/class/Moderation/UserRegistrationList.php

74 lines
3.2 KiB
PHP
Raw Normal View History

<?php
namespace Moderation;
use Core\Db;
use User;
class UserRegistrationList
{
2023-12-19 01:58:37 +00:00
/** Регистрации персонажей: только для администраторов.
* @return void
*/
public static function get(): void
{
$query = "select users.id, host_reg, banned, battle, online, molch1
from users left join stats on users.id = stats.id
where bithday != '01.01.1800' and bot = 0 and timereg between ? and ? order by users.id";
$pld520 = date('d.m.Y');
if (isset($_POST['loginLD520'])) {
$pld520 = $_POST['loginLD520'];
}
$pld520TS = strtotime(str_replace(".", "-", $pld520));
$pld520 = date('d.m.Y', $pld520TS);
?>
<script>
const regx = document.getElementById('loginLD520')
function regprev() {
regx.value = '<?= date('d.m.Y', ($pld520TS - 86400)) ?>';
}
function regnext() {
regx.value = '<?= date('d.m.Y', ($pld520TS + 86400)) ?>';
}
</script>
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
2023-12-19 01:58:37 +00:00
<h4>Регистрации персонажей</h4>
<label for="loginLD520">Дата регистрации</label>
<input name="pometka520" class="btn btn-success" onclick="regprev()" type="submit" value="&laquo;"/>
<input value="<?= $pld520 ?>" name="loginLD520" type="text" id="loginLD520" size="20" maxlength="10"/>
<input name="pometka520" class="btn btn-success" onclick="regnext()" type="submit" value="&raquo;"/>
2023-12-19 01:58:37 +00:00
<input type="submit" name="pometka520" id="pometka520" class="btn" value="Показать"/>
<?php if (isset($_POST['pometka520'])): ?>
2023-12-19 01:58:37 +00:00
<br><b style="color: red;">Персонажи зарегистрированные <?= $pld520 ?></b>
<ol>
<?php foreach (Db::getRows($query, [$pld520TS, $pld520TS + 86400]) as $pl):
$logincolor = match (true) {
$pl['banned'] > 0 => 'red',
$pl['online'] > time() - 520 => 'green',
default => 'black',
};
?>
<li>
<span style="color: <?= $logincolor ?>"> <?= User::getLogin($pl['id']) ?> </span>
<?php if ($pl['molch1'] > time()): ?>
2023-12-19 01:58:37 +00:00
<i>(молчит)</i>
<?php endif; ?>
<?php if ($pl['battle'] > 0): ?>
2023-12-19 01:58:37 +00:00
<a href="/logs.php?log=<?= $pl['battle'] ?>" target="_blank">(в бою)</a>
<?php endif; ?>
<?php if ($pl['host_reg'] > 0): ?>
2023-12-19 01:58:37 +00:00
<small>(реферал персонажа <?= User::getLogin($pl['host_reg']) ?>)</small>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
</div>
<?php
}
}