Файл: public_html/modules/panel/mail.php
Строк: 23
<?php
include_once ('../../core/base.php');
$header = 'Чтение почты';
include_once ('../../core/head.php');
falseauth();
adm();
switch($_GET['case'])
{
case 'read':
$id = fl($_GET['id']);
$usInfo = $db->query("SELECT * FROM `users` WHERE `id` = '".$id."'")->num_rows;
if($usInfo == 0) redirect('/access/mail');
$count = $db -> query("SELECT * FROM `mail_messages` WHERE `user1` = '".$id."'") -> num_rows;
$k_page = k_page($count,10);
$page = page($k_page);
$start = 10*$page-10;
$sql = $db -> query("SELECT * FROM `mail_messages` WHERE `user1` = '".$id."' ORDER BY `time` DESC LIMIT $start, 10");
if($count > 0)
{
while($q = $sql->fetch_object())
{
echo '<div class="b">
Отправитель: '.who($id).'<br>
Кому: '.who($q->user2).'<br>
Время отправки: '.tm($q->time).'<br>
Сообщение: '.$q->message.'
</div>
<div class="line"></div>';
}
if($count >= 10) echo str('/access/mail/read'.$id.'/?',$k_page,$page);
}
break;
default:
if(isset($_GET['read']))
{
$id = fl($_POST['id']);
$usInfo = $db->query("SELECT * FROM `users` WHERE `id` = '".$id."'")->num_rows;
if($usInfo == 0) redirect('/access/mail');
redirect('/access/mail/read'.$id);
}
echo '<div class="b">
<form action="?read" method="post">
<input type="text" name="id" required placeholder="ID игрока"><br>
<input type="submit" value="Читать почту">
</form>
</div>';
break;
}
include_once ('../../core/foot.php');