Блок выводит именинников
Устанавлюем:
код блока:
создаём файл block-birth.php и ложим в папку blocks
Код:
<?php if (!defined('BLOCK_FILE')) { Header("Location: ../index.php"); exit; } ///////////////// BIRTHDAY MOD ///////////////////// $b = 0; $currentdate = date("Y-m-d", time() + $CURUSER['tzoffset'] * 60); list($year1, $month1, $day1) = split('-', $currentdate); $res = mysql_query("SELECT birthday, id, username, class, donor, warned, gender FROM users WHERE birthday != '0000-00-00'") or sqlerr(); while ($arr = mysql_fetch_assoc($res)) { $birthday = date($arr["birthday"]); $username = get_user_class_color($arr["class"], $arr["username"]); $id = $arr["id"]; list($year2, $month2, $day2) = split('-', $birthday); if (($month1 == $month2) && ($day1 == $day2)) { if ($b > 0) $content .=", "; $donator = $arr["donor"] == "yes"; if ($donator) { $username .= "<img border=\"0\" alt=\"Звезданутый\" src=\"pic/star.gif\">"; } $female = $arr["gender"] == "2"; if ($female){ $username .= "<img border=\"0\" alt=\"Девушка\" src=\"pic/ico_f.gif\">"; } $male = $arr["gender"] == "1"; if ($male){ $username .= "<img border=\"0\" alt=\"Парень\" src=\"pic/ico_m.gif\">"; } $warned = $arr["warned"] == "yes"; if ($warned) { $username .= "<img border=\"0\" alt=\"предупрежден\" src=\"pic/warned.gif\">"; } $female = $arr["gender"] == "2"; if ($female){ $username .= "<img border=\"0\" alt=\"Девушка\" src=\"pic/brt.gif\">"; } $male = $arr["gender"] == "1"; if ($male){ $username .= "<img border=\"0\" alt=\"Парень\" src=\"pic/brt.gif\">"; } $content .="<a href=userdetails.php?id=$id><b>$username</b></a>"; $b = $b + 1; } } if ($b == 0) $content .="Нет ниукаво сеня днюхи..."; ///////////////// BIRTHDAY MOD ///////////////////// ?>