Файл: mail.php
Строк: 71
<?
define('PROTECTOR', 1);
$textl='Почта';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$_GET['id']."'"));
if(isset($_GET['dialog']))
{
$rows21=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr1`='".$udata['id']."' and `usr2`='".$us['id']."'"));
if($rows21==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$udata['id']."',
`usr2`='".$us['id']."',
`read`='0'
");
$rows=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr1`='".$udata['id']."' and `usr2`='".$us['id']."'"));
header('location: dialog.php?id='.$rows['id'].'');exit;
}
else
{
$rows=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr1`='".$udata['id']."' and `usr2`='".$us['id']."'"));
header('location: dialog.php?id='.$rows['id'].'');exit;
}
}
if(isset($_GET['del']))
{
$rowsf=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `id`='".$_GET['id']."' and `usr1`='".$udata['id']."'"));
if($rowsf==0)
{
header('location: mail.php?page=0');exit;
}
else
{
mysql_query("DELETE FROM `msg_kont` WHERE `id`='".$_GET['id']."'");
mysql_query("DELETE FROM `msg_dialog` WHERE `dialog`='".$_GET['id']."'");
header('location: mail.php?page=0');exit;
}
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=?><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>Почта
</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">';
$rowsf=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$udata['id']."'"));
if($rowsf==0)
{
echo 'У вас нету активных диалогов!';
}
else
{
if ($_GET['page'] == "" || $_GET['page'] < 0 || $_GET['page'] == "0")
{
$_GET['page'] = 0;
}
$next = $_GET['page'] + 1;
$back = $_GET['page'] - 1;
$num = $_GET['page'] * 10;
if($_GET['page'] == "0")
{$i = 1;}
else{$i = ($_GET['page']*10)+1;}
$viso = mysql_num_rows(mysql_query("SELECT * FROM msg_kont"));
$puslap = floor($viso/10);
$kontakt=mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$udata['id']."' ORDER BY `time` DESC LIMIT $num,10");
while($rows=mysql_fetch_array($kontakt))
{
$usq = mysql_query("SELECT * FROM users WHERE `id`='".$rows['usr2']."'");
$us = mysql_fetch_array($usq);
$num1=mysql_num_rows(mysql_query("SELECT * FROM `msg_dialog` WHERE `dialog`='".$rows['id']."'"));
echo '<div class=blogct>';
if($rows['read']==0)
{
if($rows['usr2']==0)
{
$us['usr']='Игровая Система';
}
echo '<img src=img/main/e1.png>
<a href=dialog.php?id='.$rows['id'].'&page=0><font color=#00ff00>'.$us['usr'].'</font></a>
('.$num1.') [<a href=mail.php?del&id='.$rows['id'].'>удалить диалог</a>]
';
}
else
{
if($rows['usr2']==0)
{
$us['usr']='Игровая Система';
}
echo '<img src=img/main/e1.png>
<a href=dialog.php?id='.$rows['id'].'&page=0> <font color=#ff0000>'.$us['usr'].'</font></a> ('.$num1.')
[<a href=mail.php?del&id='.$rows['id'].'>удалить диалог</a>]
';
}
echo '</div>';
}
$kol_us=mysql_num_rows(mysql_query("SELECT * FROM `msg_dialog`"));
$pag=ceil($kol_us/10);
$m_p=$_GET['page']-2;
$mx_p=$_GET['page']+6;
echo '<table width=100%><tr>';
for($k=0; $k<=$pag; $k++)
{
if($k>=$m_p and $k<=$mx_p and $k>0)
{
$i=$k-1;
if($_GET['page']==''){$_GET['page']=0;}
if($_GET['page']!=$i)
{
echo '<td><a href=?page='.$i.'><div style="background: #000044; padding: 3px; margin-top: 3px;" class="bts bbs brs bls" align=center>'.$k.'</div></a></td>';
}
else
{
echo '<td><a href=?page='.$i.'><div style="background: #044440; padding: 3px; margin-top: 3px;" class="bts bbs brs bls" align=center>'.$k.'</div></a></td>';
}
}
}
echo'</tr></table>';
echo '<div align=center class="head m p"><font color=#00ffff>Сообщения хранятся в почте 72 часа,
далее автоматически удаляются</font></div>';
}
echo '</div></div>';
include($path.'files/down.php');
?>