Размер файла: 2.04Kb
<?
include_once "../SYSTEM/include/functions.php";
include_once "../SYSTEM/include/mysql.php";
include_once "../SYSTEM/include/param.php";
include_once "../SYSTEM/include/ban.php";
include_once "../SYSTEM/include/sess.php";
include_once "../SYSTEM/include/ban_2.php";
include_once "../SYSTEM/include/theme.php";
$title='Очистка чата';
$mesto='Очищает чат';
head();
if (!isset($user) || $user['level']<1)
{
header("Location: index.php?".SID."&");
exit;
}
echo "<div class=\"h\"><b>Удалить посты</b></div><hr />\n";
if ($mail_in_new>0)echo "<div class=\"privat\"><img src=\"../SYSTEM/themes/$them/img/mail0.gif\" alt=\"\" /> <a href=\"../mail.php?act=in\">Приват</a> [$mail_in_new]</div><hr />\n";
if (isset($_GET['act']) && $_GET['act']=='clear' && isset($_POST['write']) && isset($_POST['write2']))
{
$timeclear1=0;
if ($_POST['write2']=='sut')$timeclear1=$time-intval($_POST['write'])*60*60*24;
if ($_POST['write2']=='mes')$timeclear1=$time-intval($_POST['write'])*60*60*24*30;
$q = mysql_query("SELECT * FROM `$mysql[pref]chat` WHERE `time` < '$timeclear1';");
$del_th=0;
while ($post = mysql_fetch_array($q))
{
mysql_query("DELETE FROM `$mysql[pref]chat` WHERE `id` = '$post[id]';");
$del_th++;
}
mysql_query("OPTIMIZE TABLE `$mysql[pref]chat`;");
echo "Удалено $del_th постов<br />";
}
echo "<form method=\"post\" action=\"clear.php?act=clear\">\n";
echo "Будут удалены посты, написаные ... тому назад<br />\n";
echo "<input name=\"write\" class=\"form\" value=\"12\" type=\"text\" /><br />\n";
echo "<select class=\"form\" 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 "<input value=\"Очистка\" class=\"form\" type=\"submit\" />\n";
echo "</form>\n";
echo "<br />\n";
echo "<a href=\"index.php\">Вернуться</a>\n";
echo "<br /><a href=\"../index.php\">На главную</a><br />\n";
foot();
?>