View file mailn.php

File size: 967B
<?php
include 'inc/db.php';
include 'inc/1.php';
if (!$user)header("Location: /aut.php");
$q=mysql_query("SELECT * FROM `mail` WHERE `to` = '$user[id]' AND `read` = '0'");
if (mysql_num_rows($q)==0)header("Location: /aut.php");
mysql_query("INSERT INTO `log` (`user`, `text`, `time`) values ('$user[id]', 'Прочтение новой почты', '".time()."')");
$a=array();
while ($f=mysql_fetch_assoc($q)){
$a[]=$f['from'];
}
$v=array_unique($a);
//$c=count($v);
//$b=0;
$o=1;
//while ($b<$c){
//$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$v[$b]'"));
foreach ($v as $key => $value)
{
$ank=gus($value);
$count=mysql_num_rows(mysql_query("SELECT * FROM `mail` WHERE `to` = '$user[id]' AND `read` = '0' AND `from` = '$value'"));
echo "<div class='p".($o%2)."'>".im($ank['id'])." <a href='mail.php?id=$value'>".htmlspecialchars($ank['name'])."</a> ($count)</div>";
//$b++;
$o++;
}
include_once 'inc/foot.php';
?>