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

Размер файла: 905B
  1. <?php
  2. include 'inc/db.php';
  3. include 'inc/1.php';
  4. if (!$user)header("Location: /aut.php");
  5. $q=mysql_query("SELECT `to`, `from` FROM `mail` WHERE `to` = '$user[id]' OR `from` = '$user[id]' ORDER BY `id` DESC");
  6. $a=array();
  7. while ($f=mysql_fetch_assoc($q)){
  8. if ($f['to']==$user['id']){
  9. $a[]=$f['from'];
  10. }
  11. elseif ($f['from']==$user['id'])
  12. {
  13. $a[]=$f['to'];
  14. }
  15. }
  16. $v=array_unique($a);
  17. $c=count($v);
  18. sort($v);
  19. $b=0;
  20. $o=1;
  21. while ($b<$c){
  22. $ank=gus($v[$b]);
  23. $count=mysql_num_rows(mysql_query("SELECT `id` FROM `mail` WHERE (`to` = '$user[id]' AND `from` = '$v[$b]') OR (`from` = '$user[id]' AND `to` = '$v[$b]')"));
  24. echo "<div class='p".($o%2)."'>".im($ank['id'])." <a href='mail.php?id=$v[$b]'>".htmlspecialchars($ank['name'])."</a> ($count)</div>";
  25. $b++;
  26. $o++;
  27. }
  28. if (mysql_num_rows($q)==0)echo "<div class='msg'>Контактов нет</div>";
  29. include_once 'inc/foot.php';
  30. ?>
  31.  
  32.