Файл: test.masteram.us/adm_panel/mailshpion.php
Строк: 104
<?
include '../Core.php';include_once '../sys/inc/adm_check.php';
user_access('adm_mysql',null,'index.php?'.SID);
adm_check();
$set['title']='Шпионка';
include_once '../sys/inc/thead.php';
title();
if (user_access('adm_mysql')){
if (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 `mail` WHERE `time` < '$timeclear1'",$db);
$del_th=0;
while ($post = mysql_fetch_assoc($q))
{
mysql_query("DELETE FROM `mail` WHERE `id` = '$post[id]'",$db);
$del_th++;
}
mysql_query("OPTIMIZE TABLE `mail`",$db);
msg ("Удалено $del_th сообщений");
}
}
err();
aut(); // надо уже знать, что это такое
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `mail`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<div class='title'><center>Всего сообщений: $k_post </center></div>n";
echo "<table class='post'>n";
if ($k_post==0)
{
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Нет сообщенийn";
echo " </td>n";
echo " </tr>n";
}
$q=mysql_query("SELECT * FROM `mail` ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
if ($post['id_user']==0)
{
$ank['id']=0;
$ank['pol']='mail';
$ank['level']=0;
}
else
$ank=get_user($post['id_user']);
$ank2=get_user($post['id_kont']);
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo " <td class='gmenu'>n";
echo "От:<a href='/info.php?id=$ank[id]'>$ank[nick]</a>".online($ank['id'])."</a>n";
echo "(<a href='/adm_panel/mailshpion3.php?id=$ank[id]'>Исх.</a>/<a href='/adm_panel/mailshpion2.php?id=$ank[id]'>Вход.</a>)</a></br>n";
echo "К:<a href='/info.php?id=$ank2[id]'>$ank2[nick]</a>".online($ank2['id'])."</a>n";
echo "(<a href='/adm_panel/mailshpion3.php?id=$ank2[id]'>Исх.</a>/<a href='/adm_panel/mailshpion2.php?id=$ank2[id]'>Вход.</a>)</a></br>(Отправленно:".vremja($post['time']).")n";
if ($post['read']==0)echo "<b><font color='red'>(не прочитано)</font></b><br />n";
echo " </td>n";
echo " </tr>n";
echo " <tr>n";
if ($set['set_show_icon']==1)echo " <td class='blueline' colspan='2'>n"; else echo " <td class='p_m'>n";
echo output_text($post['msg'])."<br />n";
if (user_access('adm_mysql'))
echo "<a href='delete_mail.php?id=$post[id]'>Удалить</a><br />n";
echo " </td>n";
echo " </tr>n";
}
echo "</table>n";
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
if (user_access('adm_mysql'))
{
if (isset($_GET['act']) && $_GET['act']=='create')
{
echo "<form method="post" class='foot' action="?">n";
echo "Будут удалены сообщения, написаные ... тому назад<br />n";
echo "<input name="write" value="12" 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 "<input value="Очистить" type="submit" /><br />n";
echo "<a href="?">Отмена</a><br />n";
echo "</form>n";
}
}
echo "<div class="foot">n";
echo "<a href="?act=create">Очистить почту(по времени)</a><br />n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
?>