그누보드 3.0버전 최신 글 리스트 > 그누3 팁자료실

그누3 팁자료실

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

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

본문

아래 소스를 복사하여 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>
 &nbsp; &nbsp;<td width='' valign=top>

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

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

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

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

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

<p>
&nbsp;
<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>
추천
24

댓글 전체

고맙습니다. 잘 쓰겠습니다.

Fatal error: Call to undefined function: avatar_face() in /home/phosay_com/www/php/recent.php on line 53
53, 54열 주석처리해서 쓰면 되는지요?
전체 1,026
그누3 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT