<?
$_zb_url = "http://제로보드URL/";
$_zb_path = "/제로보드 절대경로/";
include $_zb_path."lib.php";
if(!$connect) $connect = dbconn();
$a_result = mysql_query("select name,title from $admin_table");
$o = 0;
while($a_data = mysql_fetch_array($a_result)) {
$board_id[$o] = $a_data[name];
$board_title[$o] = $a_data[title];
$o++;
}
unset($o);
$a=0;
for($i=0; $i<count($board_id); $i++) {
$result = mysql_query("select * from zetyx_board_".$board_id[$i]." where is_secret=0 order by no desc") or error(mysql_error());
while($data = mysql_fetch_array($result)) {
$tmp[$a][name] = stripslashes($data[name]); //이름
$tmp[$a][subject] = stripslashes($data[subject]); //글제목
$tmp[$a][comment] = $data[total_comment]?"[".$data[total_comment]."]":""; //코멘트수 표시
$tmp[$a][target] = $_zb_url."zboard.php?id=".$board_id[$i]."&no=".$data[no]; //타겟 설정
$tmp[$a][id] = $board_id[$i]; //게시판 DB명 설정
$tmp[$a][title] = $board_title[$i]; //게시판 TITLE 저장
$tmp[$a][no] = $data[no]; //게시물 번호 저장
$ord[$a] = $data[reg_date];
$map[$data[reg_date]] = $a;
$a++;
}
}
if($a) rsort($ord); //역순으로 하려면 rsort를 sort로 바꾸면 됨
?>
<table cellpadding="3" cellspacing="0" width="100%" style="table-layout:fixed;">
<?
$limit = 5; //출력할 글의 갯수
$i=0;
while($i<$limit && $tmp[$map[$ord[$i]]][subject]) {
$n = $map[$ord[$i]];
$subject = stripslashes($tmp[$n][subject]);
$id = $tmp[$n][id];
$title = $tmp[$n][title];
$target = $tmp[$n][target];
if($data[total_comment]) $comment_num = " <font size=\"1\" color=\"gray\" face=\"Tahoma\">[".$data[total_comment]."]</font>";
elseif($data[total_comment]==0) $comment_num = "";
?>
<tr height="23">
<td width="100%">
<p><nobr> [<a href="<?=$_zb_url?>zboard.php?id=<?=$id?>"><?=$title?></a>]<a href="<?=$target?>"> <?=$subject?></a><?=$comment_num?></nobr></p>
</td>
</tr>
<tr height="1">
<td bgcolor="#EEEEEE"></td>
</tr>
<?
$i++;
}
echo "</table>";
@mysql_close($connect);
?>
셈틀 Com/제로보드
댓글