한번만 글쓰게 하고 싶습니다~

한번만 글쓰게 하고 싶습니다~

QA

한번만 글쓰게 하고 싶습니다~

본문

하루에 같은 아이피로 글쓰기 제한하기 - 2015. 8. 24 수정

http://sir.kr/g5_tip/2298 

 

하는 소스가 있어서 적용했더니 아주 잘되더라구요~

 

글쓰기와 댓글을 제한하고 싶었는데 정말 딱 맞는 소스였습니다. 

 

그런데 아이피가 아닌 아이디로 제한하고 싶어서

 

view_comment.skin.php 

 

<?php

    if ($w != 'u') {

        $sql = " select count(*) as cnt from $write_table where wr_ip = '$_SERVER[REMOTE_ADDR]' and datediff(wr_datetime , now()) = 0  AND wr_is_comment ='1'  having count(*)  >= $board[bo_10] ";

        $row = sql_fetch($sql);

            if ($row[cnt] >= $board[bo_10]) {

                $is_comment_write =0;

            echo "<center><font color=red>이 게시판은 $board[bo_10]개의 댓글만 달 수 있습니다.</font></center><br>";

            }

    }

    if ($is_comment_write) {

        if($w == '')

            $w = 'c';

?>

 

write.skin.php 

if ($w != 'u') {

    $sql = " select count(*) as cnt from $write_table where wr_id = '$_SERVER[REMOTE_ADDR]' and datediff(wr_datetime , now()) = 0  AND wr_id_comment ='0'  having count(*)  >= $board[bo_9] "; 

    $row = sql_fetch($sql);

        if ($row[cnt] ) {

        alert("이 게시판은 $board[bo_9]개의 글만 쓸 수 있습니다.");

        }

}

 

의 wr_ip 를 wr_id로 바꿔봤구요

 

   $sql='SELECT wr_id FROM $write_table} where mb_id={$member[mb_id]}' 


로도 변경해 봤는데~ 안되네요~ $sql 소스가 변경되야 하는것 같은데~ 어떻게 변경하면 되나요~?

주말에 끝내고 쉬려고 했더니~ ㅠㅠ 

이 질문에 댓글 쓰기 :

답변 1

$sql = " select count(*) as cnt from $write_table where wr_ip = '$_SERVER[REMOTE_ADDR]' and datediff(wr_datetime , now()) = 0  AND wr_is_comment ='1'  having count(*)  >= $board[bo_10] ";

여기는 이렇게 바꾸고..

$sql = " select count(*) as cnt from $write_table where mb_id = '{$member['mb_id']}'  AND wr_is_comment ='1'  having count(*)  >= $board[bo_10] ";

 

$sql = " select count(*) as cnt from $write_table where wr_id = '$_SERVER[REMOTE_ADDR]' and datediff(wr_datetime , now()) = 0  AND wr_id_comment ='0'  having count(*)  >= $board[bo_9] ";

여기도 이렇게 바꾸고..

$sql = " select count(*) as cnt from $write_table where mb_id = '{$member['mb_id']}' AND wr_is_comment ='0'  having count(*)  >= $board[bo_9] ";

 

 

where wr_ip = '$_SERVER[REMOTE_ADDR]' and datediff(wr_datetime , now()) = 0

여기를 이렇게 바꾼 겁니다.

where mb_id = '{$member['mb_id']}'

 

직접 해봤는데 정상적으로 되네요.

답변을 작성하시기 전에 로그인 해주세요.
전체 4
QA 내용 검색

회원로그인

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