Файл: test.zfarm.mobi/mystylelink/maillink.php
Строк: 110
<?php
/////////////////////////
/*
Author MyStyle ZomBi.Biz
Год 2013 Права предоставлены автору Шехову Виталию Александровичу
http://vk.com/online_user
*/
/////////////////////////
what(0, 'mail');
$ku = $user;
$set['p_str'] = 5;
if($ban['id'])
{
echo "<ul class='pt'>
<div>
<li class='major'><span>".($ban['izg']==1?'Изгнание':"Обет Молчания до ".vremja($ban['time']))."</span>, выдал".($us_ban['pol']==2?'a':null)." <span>";
echo "".users($ban['id_who'])."</span><span>, (".$ban['msg'].")</span></li></div></ul>";
include 'IncDB/Foot.php';
exit;
}
if(isset($_GET['read_all']))
{
mysql_query("UPDATE `mystyle_mail` SET `read` = '1' WHERE `id_user` = '$ku[id]' AND `type` = 'to' AND `read` = '0'");
header("Location:?mail");
}
elseif(isset($_GET['del_all']))
{
if(isset($_GET['ok']))
{
$q=mysql_query("SELECT * FROM `mystyle_mail` WHERE `id_user` = '$ku[id]'");
while($post=mysql_fetch_array($q))
{
if($post['type']=='to' && $post['read']==1)mysql_query("DELETE FROM `mystyle_mail` WHERE `id` = '$post[id]'");
elseif($post['type']=='at')mysql_query("DELETE FROM `mystyle_mail` WHERE `id` = '$post[id]'");
}
header("Location:?mail");
}
echo '<div>
<div class="feedbackPanel">
<div class="whiteLink">Вы уверены?</div>
<div style="text-align: center;">
<div class="fl" style="width: 49%;">
<a class="btn" href="?mail&del_all&ok">
<img width="16" height="16" alt="o" src="/images/icons/tick.png"/>
<span>Подтверждаю!</span>
</a>
</div>
<div class="fr" style="width: 49%;">
<a class="btn" href="?mail&del_all">
<img width="16" height="16" alt="o" src="/images/icons/cross.png"/>
<span>Отказываюсь!</span>
</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>';
}
elseif(isset($_GET['del']) && intval($_GET['del'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_mail` WHERE `id` = '".intval($_GET['del'])."' AND `id_user` = '$ku[id]' LIMIT 1"),0)!=0)
{
mysql_query("DELETE FROM `mystyle_mail` WHERE `id` = '".intval($_GET['del'])."'");
header("Location:?mail");
}
elseif(isset($_GET['msg']) && intval($_GET['msg'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_mail` WHERE `id` = '".intval($_GET['msg'])."' AND `id_user` = '$ku[id]' LIMIT 1"),0)!=0)
{
$msgq=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_mail` WHERE `id` = '".intval($_GET['msg'])."' AND `id_user` = '$ku[id]' LIMIT 1"));
if($msgq['type']=='to' && $msgq['read']==0)
{
mysql_query("UPDATE `mystyle_mail` SET `read` = '1' WHERE `id` = '$msgq[id]'");
mysql_query("UPDATE `mystyle_mail` SET `read` = '1' WHERE `id` = '".($msgq['id']+1)."'");
header("Location:?mail&msg=$msgq[id]");
}
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_user` WHERE `id` = '$msgq[id_kont]'"));
$anku=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_user` WHERE `id` = '$ank[id]'"));
echo "<div>
<div class="emptyPanel">";
echo '<div class="feedbackPanel">
<div class="whiteLink">Просмотр сообщения:</div> </div> ';
echo "<li><span class='minor'>".($msgq['type']=='to'?"От":"Кому").":</span> <span>";
//if($msgq['id_kont']!=0)echo users($ank['id']);
echo " ".($msgq['id_kont']==0?"Почтовый Сервис":"<a class='' href='?user=$ank[id]'>".users($ank['id'])."</a>")."</span></li><li><div class='title'><p>".mat(smile(bbcode($msgq['msg'])))."</p></div></li><li class='small minor'><span>".vremja($msgq['time'])."</span></li>
".($msgq['id_kont']==0?"":"")."
</div>";
}
else
{
if(isset($_GET['history']) && intval($_GET['history'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_user` WHERE `id` = '".intval($_GET['history'])."'"),0)!=0)
{
$id = intval($_GET['history']);
$history=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_user` WHERE `id` = '".$id."'"),0);
$historyu=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_user` WHERE `id` = '$id'"));
}
echo '<div class="feedbackPanel">
<div class="whiteLink">Системные сообщения</div> </div> ';
echo '<div class="content"><div class="block">';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_mail` WHERE ".(isset($history)?"`id_kont` = '$id' AND `id_user` = '$ku[id]'":"".(isset($_GET['new'])?"`read` = '0' AND ":null)."`id_user` = '$ku[id]'").""),0);
if ($k_post==0)
{
echo "".(isset($history)?"У вас нет переписки с <a class='title' href='?profile=$id'>$historyu[nick]</a>":"
<div class="panel level">Нет сообщений от системы</div>
")."";
echo '<br />';
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `mystyle_mail` WHERE ".(isset($history)?"`id_kont` = '$id' AND `id_user` = '$ku[id]'":"".(isset($_GET['new'])?"`read` = '0' AND ":null)."`id_user` = '$ku[id]'")." ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while($post=mysql_fetch_array($q))
{
echo '<li class="emptyPanel">';
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_user` WHERE `id` = '$post[id_kont]'"));
$anku=mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_user` WHERE `id` = '$ank[id_user]'"));
echo "<div class='blueLink'><img width='16' height='16' src='images/icons/".($post['type']=='to'?"".($post['read']==0?"mail_new.png":"mail_income.png")."":"mail_outcome.png")."' alt='o'><span>";
echo "<span class='nobr'> ".($post['id_kont']==0?"Почтовый Сервис":"".users($ank['id'])."")."</span> <span class='minor small'>(<span>".vremja($post['time'])."</span>)</span></div><div><a href='?mail&msg=$post[id]'><span><p class='level'>".cut_msg(mat(smile(bbcode($post['msg']))))."...</p></span></a></div></span>";
echo '</li>';
}
if($k_page>1)str("?mail".(isset($_GET['new'])?"&new":null)."".(isset($history)?"&history=$id":null)."&",$k_page,$page); // Вывод страниц
echo "<br />";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_mail` WHERE `id_user` = '$ku[id]' AND `read` = '0'"),0)!=0)
echo "<a class="btn" href='?mail&read_all'>Отметить все как прочитанные</a>";
echo "<a class="btn" href='?mail&del_all'> Удалить все прочитанные</a></div>";
}
?>