테스트 사이트 - 개발 중인 베타 버전입니다

SIR 코멘트, 조회수 top, bottom 10 소스 첨부합니다.

저희 회사에서 사용하는 SIR 코멘트, 조회수 top, bottom 10 소스 입니다.

<?
include_once("./_common.php");

define("_CO_INDEX_", TRUE);

$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
include_once("./_head.php");

$before_day = 1;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));

$list1 = array();

$top1 = $top2 = 10;
$gr_id = "community";
$sql = " select bo_table, bo_notice from $g4[board_table]
where gr_id = '$gr_id'
and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql2 = " select * from $g4[write_prefix]$row[bo_table]
where wr_comment > -1
and wr_datetime >= '$before_time' ";
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
{
$key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
$list1[$key][subject] = conv_subject($row2[wr_subject],40,'…');
$list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list1[$key][bo_table] = $row[bo_table];
$list1[$key][wr_id] = $row2[wr_id];
$list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list1[$key][comment] = $row2[wr_comment];
$list1[$key][comment_cnt] = "($row2[wr_comment])";

$key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
$list2[$key][subject] = conv_subject($row2[wr_subject],40,'…');
$list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list2[$key][bo_table] = $row[bo_table];
$list2[$key][wr_id] = $row2[wr_id];
$list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list2[$key][wr_hit] = $row2[wr_hit];
$list2[$key][hit] = "($row2[wr_hit])";
}
}
$list3 = $list1;
$list4 = $list2;

krsort($list1);
krsort($list2);

ksort($list3);
ksort($list4);

$latest_skin_path = "$g4[path]/skin/latest/basic";
?>


<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="345" valign=top>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
<td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 BOTTOM <?=$top1?></strong></font>&nbsp;</td>
<td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
<td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$i=0;
foreach($list3 as $key=>$value) {
if ($i++>=($top1-1)) break;
?>
<tr>
<td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
<td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
<?
echo $list3[$key][icon_reply] . " ";
echo "<a href='{$list3[$key][href]}'>";
if ($list3[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list3[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list3[$key][subject]}</font>";
echo "</a>";

if ($list3[$key][comment_cnt])
echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list3[$key][comment_cnt]}</span>";
?>
</td>
</tr>
<? } ?>

<? if (count($list3) == 0) { ?>
<tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
</td>
<td width="20">&nbsp;</td>
<td width="345" valign=top>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
<td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 BOTTOM <?=$top1?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
<td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
<td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$i=0;
foreach($list4 as $key=>$value) {
if ($i++>=($top1-1)) break;
?>
<tr>
<td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
<td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
<?
echo $list4[$key][icon_reply] . " ";
echo "<a href='{$list4[$key][href]}'>";
if ($list4[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list4[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list4[$key][subject]}</font>";
echo "</a>";

if ($list4[$key][hit])
echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list4[$key][hit]}</span>";
?>
</td>
</tr>
<? } ?>

<? if (count($list4) == 0) { ?>
<tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
</td>

</tr></table>
<br><br>


<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="345" valign=top>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
<td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 TOP <?=$top1?></strong></font>&nbsp;</td>
<td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
<td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$i=0;
foreach($list1 as $key=>$value) {
if ($i++>=($top1-1)) break;
?>
<tr>
<td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
<td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
<?
echo $list1[$key][icon_reply] . " ";
echo "<a href='{$list1[$key][href]}'>";
if ($list1[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list1[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
echo "</a>";

if ($list1[$key][comment_cnt])
echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list1[$key][comment_cnt]}</span>";
?>
</td>
</tr>
<? } ?>

<? if (count($list1) == 0) { ?>
<tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
</td>
<td width="20">&nbsp;</td>
<td width="345" valign=top>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
<td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 TOP <?=$top1?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
<td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
<td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$i=0;
foreach($list2 as $key=>$value) {
if ($i++>=($top1-1)) break;
?>
<tr>
<td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
<td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
<?
echo $list2[$key][icon_reply] . " ";
echo "<a href='{$list2[$key][href]}'>";
if ($list2[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
echo "</a>";

if ($list2[$key][hit])
echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>";
?>
</td>
</tr>
<? } ?>

<? if (count($list2) == 0) { ?>
<tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
</td>

</tr></table>
<br><br>

<?
include_once("./_tail.php");
?>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 19개

근데 이거..전체그룹에서 뽑아서 할려면 어떻게 해야하나요? 한 그룹말고..여러그룹에서 조회수 별로..
쭉쭉나오게 하려면... 정말 좋은 프로그램 감사합니다..복받으실겁니다.
고맙습니다. 훌륭합니다. 저도 APM에서는 안되더니 서버에 올리니 되네요.
bbking
20년 전
감사합니다............실제 서버에 올리니 해결 되군요.......^^
bbking
20년 전
Warning: krsort() expects parameter 1 to be array, null given in d:\apm_setup\htdocs\4_01\top10.php on line 52
Warning: ksort() expects parameter 1 to be array, null given in d:\apm_setup\htdocs\4_01\top10.php on line 55
Warning: Invalid argument supplied for foreach() in d:\apm_setup\htdocs\4_01\top10.php on line 109
Warning: Invalid argument supplied for foreach() in d:\apm_setup\htdocs\4_01\top10.php on line 200

보람찬님의 설명처럼 했는데도 (그룹은 bbs 하나밖에 없어서 bbs로 했습니다..)
요런 오류가 나오는 군요.... 혹 해결법을 아시는분 계세요?....^^;
감사합니다.잘쓰겠습니다...
오~ 되네요 ㅋㅋ 보람찬님의 도움을 많이 받고 있습니다. ㅡ.ㅡㅋ
10번째줄 $before_day = 1; 에서 1을 좀 길게 한 10일 정도로 해주시고요..(최근게시물이 적거나 없을수도 있으므로..)
16번째줄 $gr_id = "community"; 을 자신에 맞는 그룹명으로 바꿔야 됩니다.....
제가 뭐 잘못건드렸나 ㅡ.ㅡ;;
아래 포인트 순위는 되지만 이거는 안되네용. ㅡ.ㅡ;;
line 52, 55,119,209
Warning: krsort() expects parameter 1 to be array, null given in /home/hosting_users/rino888/www/city/top10.php on line 52

Warning: ksort() expects parameter 1 to be array, null given in /home/hosting_users/rino888/www/city/top10.php on line 55

리눅스 서버 cafe24인데 이런 에러가나네요?
SIR 코멘트, 조회수 top, bottom 10 소스 첨부합니다.
이미지도 좀 올려주시지 ㅠ_ㅠ
$gr_id = "community"; 수정하니까 Warning 해결
첫 베스트 수가 이미지하고 내용 제목이 나오게 하려면 어떻게 하면 되나여 고수분들 부탁합니다
좋은소스 감사합니다.
여기서 추천수 순서로 나오게 할려면 어떻게 해야되나요?
SIR 코멘트, 조회수 top, bottom 10 소스 첨부합니다

게시판 목록

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
글쓰기
🐛 버그신고