스크랩 건수도 베스트글 선정 기준에 추가하면 좋겠다는 의견을 접수.
거의 반년을 땡땡이...ㄷㄷ
게시판 설정 테이블에 db field 추가
ALTER TABLE `g4_board` ADD `bo_list_scrap` INT( 11 ) NOT NULL AFTER `bo_list_view`
adm/board_form.php에
<tr class='ht'>
<td><input type=checkbox name=chk_list_scrap value=1></td>
<td>베스트글(스크랩수)</td>
<td><input type=text class=ed name=bo_list_scrap size=5 value='<?=$board[bo_list_scrap]?>'> 베스트글 게시판에 등록</td>
</tr>
<td><input type=checkbox name=chk_list_scrap value=1></td>
<td>베스트글(스크랩수)</td>
<td><input type=text class=ed name=bo_list_scrap size=5 value='<?=$board[bo_list_scrap]?>'> 베스트글 게시판에 등록</td>
</tr>
adm/board_form_update.php
$bo_list_scrap = $_POST[bo_list_scrap];
...
bo_list_scrap = '$bo_list_scrap',
...
if ($chk_list_scrap) $s .= " , bo_list_scrap = '$bo_list_scrap' ";
...
bbs/scrap_popin_update.php의 마지막 부분쪽에
// 불당팩 - 스크랩수에 따라서 베스트글 등록
if ($board['bo_list_scrap'] > 0) {
$sql = " select count(*) as cnt from $g4[scrap_table] where bo_table='$bo_table' and wr_id='$wr_id' ";
$scrap_good = sql_fetch($sql);
if ($scrap_good['cnt'] >= $board['bo_list_scrap']) {
// UPDATE를 먼저하고 오류가 발생시 insert를 실행
$sql = " update $g4[good_list_table] set good = good + 1 where bo_table='$bo_table' and wr_id='$wr_id' ";
$result = sql_query($sql, FALSE);
if ( mysql_affected_rows() == 0 ) {
$sql = " insert $g4[good_list_table] ( mb_id, gr_id, bo_table, wr_id, gl_datetime, good, wr_datetime) values ( '$write[mb_id]', '$board[gr_id]', '$bo_table', '$wr_id', '$g4[time_ymdhis]', '$list_good[cnt]', '$write[wr_datetime]' ) ";
$result = sql_query($sql);
}
}
}
if ($board['bo_list_scrap'] > 0) {
$sql = " select count(*) as cnt from $g4[scrap_table] where bo_table='$bo_table' and wr_id='$wr_id' ";
$scrap_good = sql_fetch($sql);
if ($scrap_good['cnt'] >= $board['bo_list_scrap']) {
// UPDATE를 먼저하고 오류가 발생시 insert를 실행
$sql = " update $g4[good_list_table] set good = good + 1 where bo_table='$bo_table' and wr_id='$wr_id' ";
$result = sql_query($sql, FALSE);
if ( mysql_affected_rows() == 0 ) {
$sql = " insert $g4[good_list_table] ( mb_id, gr_id, bo_table, wr_id, gl_datetime, good, wr_datetime) values ( '$write[mb_id]', '$board[gr_id]', '$bo_table', '$wr_id', '$g4[time_ymdhis]', '$list_good[cnt]', '$write[wr_datetime]' ) ";
$result = sql_query($sql);
}
}
}
bbs/scrap_delete.php에 아래 코드 추가
// 불당팩 - 스크랩수에 따라서 베스트글 등록된 경우... 스크랩이 지워지면 good count도 하나 빼준다
if ($board['bo_list_scrap'] > 0) {
$sql = " update $g4[good_list_table] set good = good - 1 where bo_table='$bo_table' and wr_id='$wr_id' ";
$result = sql_query($sql, FALSE);
}
if ($board['bo_list_scrap'] > 0) {
$sql = " update $g4[good_list_table] set good = good - 1 where bo_table='$bo_table' and wr_id='$wr_id' ";
$result = sql_query($sql, FALSE);
}
- opencode.co.kr -
˷ּ.
ƮƮ̳ ؾ ͽϴ...