Просмотр файла kont.php

Размер файла: 947B
<?php
include 'inc/db.php';
include 'inc/1.php';
if (!$user)header("Location: /aut.php");
$q=mysql_query("SELECT `to`, `from` FROM `mail` WHERE `to` = '$user[id]' OR `from` = '$user[id]' ORDER BY `time` DESC");
$a=array();
while ($f=mysql_fetch_assoc($q)){
if ($f['to']==$user['id']){
$a[]=$f['from'];
}
elseif ($f['from']==$user['id'])
{
$a[]=$f['to'];
}
}
$v=array_unique($a);
$c=count($v);
//sort($v);
//$b=0;
$o=1;
//while ($b<$c){
foreach ($v as $key => $value)
{
$ank=gus($value);
$count=mysql_num_rows(mysql_query("SELECT `id` FROM `mail` WHERE (`to` = '$user[id]' AND `from` = '$value') OR (`from` = '$user[id]' AND `to` = '$value')"));
echo "<div class='p".($o%2)."'>".im($ank['id'])." <a href='mail.php?id=$value'>".htmlspecialchars($ank['name'])."</a> ($count)</div>";
//$b++;
$o++;
}
if (mysql_num_rows($q)==0)echo "<div class='msg'>Контактов нет</div>";
include_once 'inc/foot.php';
?>