Файл: ajax/listDialogs.php
Строк: 20
<?php
require_once ('../system/function.php');
$user['id'] = (int)$_GET['us_id'];
$start = (int)$_GET['start'];
$max = (int)$_GET['max'];
$dialog = mysql_query("SELECT * FROM `message_c` WHERE `kto` = '".$user['id']."' and `del` = '0' ORDER BY `posl_time` DESC LIMIT $start, $max");
while($d = mysql_fetch_assoc($dialog))
{
echo '<div class="links">';
$list = mysql_fetch_assoc(mysql_query("SELECT * FROM `message` WHERE `kto` = '".$user['id']."' and `komy` = '".$d['kogo']."' or `kto` = '".$d['kogo']."' and `komy` = '".$user['id']."' ORDER BY `time` DESC LIMIT 1"));
if(!empty($list['id']) and $user['id'] != $list['kto'] and $list['readlen'] == 0){
echo ' <img src="'.$HOME.'/images/readlen.png" alt="*" />';
}
echo ''.nick($d['kogo']).' (<a href="'.$HOME.'/mes/dialog'.$d['kogo'].'">переписка</a>) (<a href="'.$HOME.'/mes/del_c'.$d['kogo'].'">удалить</a>)</div>';
$count = mysql_result(mysql_query("SELECT COUNT(id) FROM `message` WHERE `kto` = '".$user['id']."' and `komy` = '".$d['kogo']."' or `kto` = '".$d['kogo']."' and `komy` = '".$user['id']."'"),0);
echo '</div>';
}
?>