Кароче в func.php вставить:
/////////////////////////////////////////////////////////////////////////
function dn_new()
{
global $user_id;
global $realtime;
if ($user_id)
{
$req = mysql_query("SELECT COUNT(*) FROM `dnevniki`
LEFT JOIN `cms_dn_rdm` ON `dnevniki`.`id` = `cms_dn_rdm`.`topic_id` AND `cms_dn_rdm`.`user_id` = '" . $user_id . "'
WHERE `dnevniki`.`type`='1'
AND (`cms_dn_rdm`.`topic_id` Is Null
OR `dnevniki`.`vr` > `cms_dn_rdm`.`time`);");
return mysql_result($req, 0);
} else
{
return false;
}
}
/////////////////////////////////////////////////////////////////////
function fdn()
{
global $realtime;
global $user_id;
$fl = mysql_query("SELECT COUNT(*) FROM `dnevniki` WHERE `type`='1' ;");
$countf = mysql_result($fl, 0);
$req = mysql_query("SELECT COUNT(*) FROM `dnevniki`
LEFT JOIN `cms_dn_rdm` ON `dnevniki`.`id` = `cms_dn_rdm`.`topic_id` AND `cms_dn_rdm`.`user_id` = '" . $user_id . "'
WHERE `dnevniki`.`type`='1'
AND (`cms_dn_rdm`.`topic_id` Is Null
OR `dnevniki`.`vr` > `cms_dn_rdm`.`time`);");
$countf1 = mysql_result($req, 0);
$out = $countf;
if ($countf1 > 0 && isset($user_id))
{
$out = $out . "/<font color='#FF0000'>+$countf1</font>";
}
return $out;
}
///////////////////////////////////////////////////////////////////////////////
В mainmmenu.php добавить:
echo'<div class="menu"><a href="dn/?">Ваши дневники</a> (' . fdn() . ')</div>';