k

그누보드 3.0버전 최신 글 리스트

· 2003-08-21 (목) 13:19:24 · 3506 · 6
아래 소스를 복사하여 list_new.php파일로 저장하여 gnu폴더에 올리시고
http://URL/gnu/?doc=list_new.php <-불러 오면 됩니다..^^

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

define("_DOCTYPE_", "DESIGN");

include "./$cfg[bbs_dir]/gblayer.php";
$html_title = "최신글 리스트";
?>

<table width=100% cellpadding=0 cellspacing=0>
<tr>
   <td width='' valign=top>

<?
if ($hours < 1 || $hours > 168) {
   $hours = 6;
}
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * $hours));

$sql = " select a.bo_subject, a.bo_table, b.gr_subject
          from $cfg[table_board] a, $cfg[table_group] b
         where a.gr_id = b.gr_id
         order by b.gr_id, a.bo_table ";
$result = sql_query($sql);
while ($row = mysql_fetch_array($result)) {
   $tbl = "{$cfg[write_table_prefix]}{$row[bo_table]}";
   $sql2 = " select a.wr_id,
                    a.wr_parent_id,
                    a.mb_id,
                    a.wr_name,
                    a.wr_email,
                    a.wr_num,
                    a.wr_subject,
                    a.wr_comment,
                    a.wr_commentcnt,
                    a.wr_datetime,
                    b.mb_icon
               from $tbl a left join $cfg[table_member] b on (a.mb_id = b.mb_id)
              where a.wr_datetime >= '$intime'
              order by a.wr_id desc ";
   $result2 = sql_query($sql2);
   for ($i = 0; $row2 = mysql_fetch_array($result2); $i++) {  
       if ($row2[wr_comment] > 0) {
           $sql3 = " select wr_subject
                       from $tbl
                      where wr_comment = 0
                        and wr_parent_id = '$row2[wr_parent_id]' ";
           $row3 = sql_fetch($sql3);
           $wr_subject = $row3[wr_subject];        
       } else {
           $wr_subject = $row2[wr_subject];
       }
$wr_subject = get_text($wr_subject);
       $key = $row2[wr_datetime] . $row[bo_table] . $row2[wr_id];
       $list[$key]->bo_table = $row[bo_table];
       $list[$key]->mb_id = $row2[mb_id];
       $list[$key]->mb_icon = $row2[mb_icon];
       $list[$key]->wr_id = $row2[wr_id];
       $list[$key]->wr_parent_id = $row2[wr_parent_id];
       $list[$key]->wr_email = $row2[wr_email];
       $list[$key]->wr_name = get_text(cut_str($row2[wr_name],12));
       $list[$key]->wr_subject = get_text(cut_str($wr_subject,65,'…'));
       $list[$key]->wr_comment = $row2[wr_comment];
       $list[$key]->wr_commentcnt = $row2[wr_commentcnt];
       $list[$key]->wr_datetime = $row2[wr_datetime];
   }
   mysql_free_result($result2);
}
mysql_free_result($result);
?>
<table width=600>
<tr><td colspan=3 background='./{$cfg[bbs_dir]}/line.gif'></td></tr>
<tr>
   <td height=30 bgcolor=EEEEEE colspan=3 align=center>  <b><font color=1079DE><?=$hours?> 시간 이내에 올라온 새글</font></b></td>
</tr>
<tr><td colspan=3 background='./{$cfg[bbs_dir]}/line.gif'></td></tr>
<?
if (count($list) > 0) {
   krsort($list);
   foreach ($list as $key=>$value) {
       $comment = "";
       $atag_comment = "";
       if ($value->wr_comment > 0) {
           $comment = "<span style='font-size:8pt;'>[c]</span> ";
           $atag_comment = "#c{$value->wr_id}";
       }

       $commentcnt = "";
       if ($value->wr_commentcnt > 0)
           $commentcnt = "<font size=-2>({$value->wr_commentcnt})</font>";

       $wr_name = gblayer($value->mb_id, $value->wr_name, $value->wr_email);

       echo "<tr onMouseOver=this.style.backgroundColor='#fafafa' onMouseOut=this.style.backgroundColor=''>";
       echo "<td width=130 align=center><font color=gray>[".$value->wr_datetime."]</font></td>";
       echo "<td>  <a href='./?doc=$cfg[bbs_dir]/gnuboard.php&bo_table=".$value->bo_table."&wr_id=".$value->wr_parent_id."$atag_comment'>";
       echo "<font color=#222222>$comment{$value->wr_subject} {$commentcnt}</font></a></td>";
       echo "<td width=120 align=center>$mb_icon$wr_name$admin_icon</td>";
       echo "</tr>";

       echo "<tr><td colspan=3 background='./{$cfg[bbs_dir]}/line.gif'></td></tr>";
   }
} else
   echo "<td height=25 align=center>등록된 글이 없습니다.</td>";
?>
</table>

<p>
 
<a href='./?doc=list_new.php&hours=1'>1시간</a> |
<a href='./?doc=list_new.php&hours=2'>2시간</a> |
<a href='./?doc=list_new.php&hours=3'>3시간</a> |
<a href='./?doc=list_new.php&hours=6'>6시간</a> |
<a href='./?doc=list_new.php&hours=12'>12시간</a> |
<a href='./?doc=list_new.php&hours=24'>24시간</a> |
<a href='./?doc=list_new.php&hours=48'>48시간</a> |
<a href='./?doc=list_new.php&hours=72'>72시간</a> |
<a href='./?doc=list_new.php&hours=168'>1주일</a>
<p>

</td>
</tr>
</table>
|

댓글 6개

감사합니다.
감사합니다.. 잘 쓰겠습니다..
MMando
2003-08-21 (목) 21:05:28
감사합니다..
고맙습니다. 잘 쓰겠습니다.

Fatal error: Call to undefined function: avatar_face() in /home/phosay_com/www/php/recent.php on line 53
53, 54열 주석처리해서 쓰면 되는지요?
그누보드와 아바타에 적용한걸 그대로 올렸군요..ㅎㅎㅎ
53 54 삭제하시면 됩니다..^^
위에 소스 수정했습니다.
아 드디어 올라오는군요..
정말 오래 기다 렸는데요..
다시 한번 감사드립니다..
최강그누보드
댓글을 작성하시려면 로그인이 필요합니다.

그누3 팁자료실

1,026건
+
제목 글쓴이 날짜 조회
03-08-25 조회 3,067
03-08-25 조회 2,223
03-08-23 조회 1.4만
03-08-22 조회 3,550
03-08-22 조회 2,368
03-08-22 조회 2,389
03-08-21 조회 3,601
03-08-21 조회 4,294
03-08-21 조회 3,507
03-08-20 조회 2,783
OOh!HappyDays
03-08-20 조회 2,062
03-08-19 조회 2,416
03-08-15 조회 2,003
03-08-13 조회 2,402
03-08-13 조회 2,834
03-08-13 조회 2,777
03-08-13 조회 2,431
03-08-13 조회 2,246
03-08-12 조회 2,901
03-08-10 조회 2,361