|
<?php
require_once ('../system/function.php');
$id = (int)$_GET['id'];
$start = (int)$_GET['start'];
$max = (int)$_GET['max'];
$mess['id'] = (int)$_GET['id'];
$msg = mysql_query("SELECT * FROM `message` WHERE `kto` = '".$user['id']."' and `komy` = '".$mess['id']."' or `kto` = '".$mess['id']."' and `komy` = '".$user['id']."' ORDER BY `time` DESC LIMIT $start, $max");
while($m = mysql_fetch_assoc($msg))
{
echo '<div class="links">';
if($m['kto'] == $user['id']) echo '<b>Вы </b>';
else echo nick($m['kto']).' ';
echo vremja($m['time']);
if($m['readlen'] == 0) {
echo ' [<font color="red">Не прочитано</font>]';
} else {
echo ' [<font color="green">Прочитано</font>]';
}
$sav = mysql_fetch_assoc(mysql_query("SELECT * FROM `message_save` WHERE `uid` = '".$m['id']."'"),0);
if($sav == 0) echo '
[<a href="'.$HOME.'/mes/save_mes'.$m['id'].'">save</a>]';
echo '</div><div class="podmenu">'.bb(smile($m['text'])).'</div>';
if($m['file'])
echo '<div class="podmenu"><a href="../files/mes/'.$m['file'].'">'.$m['file'].'</a> ['.fsize('../files/mes/'.$m['file']).']</div>';
if($user['id'] == $m['komy']) {
mysql_query("UPDATE `message` SET `readlen` = '1' WHERE `id`='".$m['id']."' limit 1");
}
}
?>