Пример #1
0
 require_once 'lib/lunar.php';
 $lunar = new Lunar();
 for ($i = 0; $i < 5; $i++) {
     $ct = getftime(time() + 86400 * $i);
     $bdb[] = '(bir_m=' . date('n', $ct) . ' and bir_d=' . date('j', $ct) . ' and isnl=0)';
     $nl = $lunar->S2L($ct);
     $bdb[] = '(bir_m=' . $nl[0] . ' and bir_d=' . $nl[1] . ' and isnl=1)';
 }
 $nl_t = $lunar->S2L(getftime());
 $s_dbu = sprintf('select id, name, isnl, bir_m, bir_d from %s where %s', $dbprefix . 'member', join(' or ', $bdb));
 $q_dbu = mysql_query($s_dbu) or die('');
 $r_dbu = mysql_fetch_assoc($q_dbu);
 if (mysql_num_rows($q_dbu) > 0) {
     $content .= '<li>生日榜<ol>';
     do {
         $sr_c = $r_dbu['isnl'] > 0 ? $lunar->LMonName($r_dbu['bir_m']) . '月' . $lunar->LDayName($r_dbu['bir_d']) . '日' : '' . $r_dbu['bir_m'] . '月' . $r_dbu['bir_d'] . '日';
         $content .= '<li>' . ($r_dbu['isnl'] == 1 && $r_dbu['bir_m'] == $nl_t[0] && $r_dbu['bir_d'] == $nl_t[1] || $r_dbu['isnl'] == 0 && $r_dbu['bir_m'] == date('n', getftime()) && $r_dbu['bir_d'] == date('j', getftime()) ? '<img src="images/cake.gif" alt="" title="生日快乐!" /> ' : '') . '<a href="?m=user&amp;id=' . $r_dbu['id'] . '">' . $r_dbu['name'] . '</a> (<span title="生日:' . ($r_dbu['isnl'] > 0 ? '农历' : '') . $sr_c . '">' . $sr_c . '</span>)</li>';
     } while ($r_dbu = mysql_fetch_assoc($q_dbu));
     $content .= '</ol></li>';
 }
 mysql_free_result($q_dbu);
 $s_dbc = sprintf('select id, title from %s where closed=0 and disp=0 order by datetime desc limit 3', $dbprefix . 'camp');
 $q_dbc = mysql_query($s_dbc) or die('');
 $r_dbc = mysql_fetch_assoc($q_dbc);
 if (mysql_num_rows($q_dbc) > 0) {
     $content .= '<li>最新活动<ol>';
     do {
         $content .= '<li><a href="?m=camp&amp;id=' . $r_dbc['id'] . '" title="' . $r_dbc['title'] . '">' . substrs($r_dbc['title']) . '</a></li>';
     } while ($r_dbc = mysql_fetch_assoc($q_dbc));
     $content .= '<li><a href="?m=camp">更多……</a></li></ol></li>';
 }