그누보드 [G5] 게시글 한번만 작성하기
페이지 정보
본문
특정 게시판에 아이디당 글을 한번만 작성하도록 하는 방법입니다.
1. 그누보드5 / skin / board / basic / list.skin.php 내용중
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경합니다. ( 위, 아래 2개 있습니다 )
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
} elseif ($row_sum["cnt"] == 1) {
$sql_view = " select wr_id from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' order by wr_id desc ";
$row_view = sql_fetch($sql_view);
echo "<li><a href='". G5_BBS_URL ."/board.php?bo_table=". $bo_table ."&wr_id=". $row_view['wr_id'] ."' class='btn_b02'>글수정</a></li>";
} else {
echo "";
}
}
?>
2. 그누보드5 / skin / board / basic / view.skin.php 내용중
<?php if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경
<?php /*if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php }*/ ?>
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
}
}
?>
3. 그누보드5 / skin / board / basic / write.skin.php 상단
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
아래에 내용 추가
if ( $w == '' ) {
$sql = "select count(*) as cnt from ".$write_table." where mb_id='".$member['mb_id']."' AND wr_is_comment ='0' ";
$row = sql_fetch( $sql );
if ( !$is_admin && $row['cnt'] > 0 ) {
alert( "게시글은 1회 만 쓸 수 있습니다. 변경내용이 있다면 기존글을 수정하십시오." );
exit;
}
}
4. 그누보드5 / mobile / skin / board / basic / list.skin.php 내용중
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
} elseif ($row_sum["cnt"] == 1) {
$sql_view = " select wr_id from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' order by wr_id desc ";
$row_view = sql_fetch($sql_view);
echo "<li><a href='". G5_BBS_URL ."/board.php?bo_table=". $bo_table ."&wr_id=". $row_view['wr_id'] ."' class='btn_b02'>글수정</a></li>";
} else {
echo "";
}
}
?>
5. 그누보드5 / mobile / skin / board / basic / view.skin.php 내용중
<?php if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경
<?php /*if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php }*/ ?>
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
}
}
?>
6. 그누보드5 / mobile / skin / board / basic / write.skin.php 상단
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
아래에 내용 추가
if ($w == '') {
$sql = "select count(*) as cnt from ".$write_table." where mb_id='".$member['mb_id']."' AND wr_is_comment ='0' ";
$row = sql_fetch( $sql );
if ( !$is_admin && $row['cnt'] > 0 ) {
alert( "게시글은 1회 만 쓸 수 있습니다. 변경내용이 있다면 기존글을 수정하십시오." );
exit;
}
}
참고자료
https://sir.kr/qa/219871
1. 그누보드5 / skin / board / basic / list.skin.php 내용중
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경합니다. ( 위, 아래 2개 있습니다 )
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
} elseif ($row_sum["cnt"] == 1) {
$sql_view = " select wr_id from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' order by wr_id desc ";
$row_view = sql_fetch($sql_view);
echo "<li><a href='". G5_BBS_URL ."/board.php?bo_table=". $bo_table ."&wr_id=". $row_view['wr_id'] ."' class='btn_b02'>글수정</a></li>";
} else {
echo "";
}
}
?>
2. 그누보드5 / skin / board / basic / view.skin.php 내용중
<?php if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경
<?php /*if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php }*/ ?>
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
}
}
?>
3. 그누보드5 / skin / board / basic / write.skin.php 상단
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
아래에 내용 추가
if ( $w == '' ) {
$sql = "select count(*) as cnt from ".$write_table." where mb_id='".$member['mb_id']."' AND wr_is_comment ='0' ";
$row = sql_fetch( $sql );
if ( !$is_admin && $row['cnt'] > 0 ) {
alert( "게시글은 1회 만 쓸 수 있습니다. 변경내용이 있다면 기존글을 수정하십시오." );
exit;
}
}
4. 그누보드5 / mobile / skin / board / basic / list.skin.php 내용중
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
} elseif ($row_sum["cnt"] == 1) {
$sql_view = " select wr_id from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' order by wr_id desc ";
$row_view = sql_fetch($sql_view);
echo "<li><a href='". G5_BBS_URL ."/board.php?bo_table=". $bo_table ."&wr_id=". $row_view['wr_id'] ."' class='btn_b02'>글수정</a></li>";
} else {
echo "";
}
}
?>
5. 그누보드5 / mobile / skin / board / basic / view.skin.php 내용중
<?php if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
를 아래와 같이 변경
<?php /*if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01">답변</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php }*/ ?>
<?php
if ($write_href) {
//if ($member['mb_level']>=3 && $write_href) {
$sql_sum = " select count(*) as cnt from ". $g5['write_prefix']. $bo_table ." where mb_id = '". $member['mb_id'] ."' and wr_is_comment='0' ";
$row_sum = sql_fetch($sql_sum);
if ($row_sum["cnt"] < 1) {
//if ($row_sum["cnt"] < 1 || $admin_href) {
echo "<li><a href='". $write_href ."' class='btn_b02'>글쓰기</a></li>";
}
}
?>
6. 그누보드5 / mobile / skin / board / basic / write.skin.php 상단
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
아래에 내용 추가
if ($w == '') {
$sql = "select count(*) as cnt from ".$write_table." where mb_id='".$member['mb_id']."' AND wr_is_comment ='0' ";
$row = sql_fetch( $sql );
if ( !$is_admin && $row['cnt'] > 0 ) {
alert( "게시글은 1회 만 쓸 수 있습니다. 변경내용이 있다면 기존글을 수정하십시오." );
exit;
}
}
참고자료
https://sir.kr/qa/219871
댓글목록
등록된 댓글이 없습니다.