Файл: adm_panel/delete_users.php
Строк: 69
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../sys/inc/user.php';
user_access('user_mass_delete', null, 'index.php?' . SID);
adm_check();
$set['title'] = 'Удаление пользователей';
include_once '../sys/inc/thead.php';
title();
if (isset($_POST['write']) && isset($_POST['write2'])) {
$timeclear1 = 0;
if ($_POST['write2'] == 'sut') {
$timeclear1 = $time - intval($_POST['write']) * 60 * 60 * 24;
} elseif ($_POST['write2'] == 'mes') {
$timeclear1 = $time - intval($_POST['write']) * 60 * 60 * 24 * 30;
} else {
$err[] = 'Не выбран период';
}
$q = mysql_query("SELECT `id` FROM `user` WHERE `date_last` < '$timeclear1'", $db);
$del_th = 0;
while ($post = mysql_fetch_assoc($q)) {
delete_user_all_data($post['id']);
$del_th++;
}
db_optimize(); // оптимизация базы
msg("Успешно удалено $del_th пользователей");
}
err();
aut();
echo "<form method="post" class='foot' action="?">n";
echo "Будут удалены пользователи, не посещавшие сайт<br />n";
echo "<input name="write" value="6" type="text" size='3' />n";
echo "<select name="write2">n";
echo "<option value="">Выбрать</option>n";
echo "<option value="mes">Месяцев</option>n";
echo "<option value="sut">Суток</option>n";
echo "</select><br />n";
echo "<button class = 'btn'>";
echo "<img src = '/style/icons/cross.png' /> Удалить";
echo "</button></form>n";
if (user_access('adm_panel_show')) {
echo "<div class = 'foot'>";
echo "<img src = '/style/icons/left.png' /> <a href = '/adm_panel/'>Панель управления</a>";
echo "</div>";
}
require_once '../sys/inc/tfoot.php';