웹마스터 팁

파일 수정/추가가 필요합니다.
테스트 결과 잘 동작합니다.

우선 스킨에서, view_comment.php - 코멘트 삭제버튼(링크) 앞에 코멘트 수정 링크 추가, modify_comment.php 추가.
(모든 스킨에서 사용 가능하게 하려면 아래처럼 제로보드 폴더의 view.php 수정 필요) --------------------------
if($c_data[ismember]) { // 이부분을 찾아 아래처럼 고쳐주세요
  if($c_data[ismember]==$member[no]||$is_admin||$member[level]<=$setup[grant_delete]) {
    $a_del="<a onfocus=blur() href='del_comment.php?$href$sort&no=$no&c_no=$c_data[no]'+ '>";
    $a_cmod="<a onfocus=blur() href='modify_comment.php?$href$sort&no=$no&c_no=$c_data[no]'>";
  }
  else {
    $a_del=" <Zeroboard ";
    $a_cmod=" <Zeroboard ";
  }
}
else {
  $a_del="<a onfocus=blur() href='del_comment.php?$href$sort&no=$no&c_no=$c_data[no]'>";
  $a_cmod="<a onfocus=blur() href='modify_comment.php?$href$sort&no=$no&c_no=$c_data[no]'>";
}
------------------------- 제로보드 폴더에서, _head.php를 수정 -------------------------
/***************************************************************************
* 현재 _head.php를 호출하는 파일이 게시판 관련 파일인지 검사
**************************************************************************/ 이 아래줄을 다음 줄로 교체
  $_zb_file_list = array("apply_vote.php","comment_ok.php","modify_comment.php","modify_comment_ok.php","del_comment.php","del_comment_ok.php","delete.php","download.php","list_all.php","view.php","vote.php","write.php","write_ok.php","zboard.php","image_box.php"); // 요걸로 바꿈


------------------------- del_comment.php를 복사, 수정하여 modify_comment.php 생성 -------------------------
<?
/***************************************************************************
* 공통 파일 include
**************************************************************************/
  include "_head.php";

  if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("정상적으로 글을 수정하여 주시기 바랍니다.");

  if(!$member) $member=member_info();

/***************************************************************************
* 코멘트 수정 페이지 처리
**************************************************************************/

// 원본글을 가져옴
  $s_data=mysql_fetch_array(mysql_query("select * from $t_comment"."_$id where no='$c_no'"));

  if($s_data[ismember]||$is_admin||$member[level]<=$setup[grant_delete]) {
          if(!$is_admin&&$s_data[ismember]!=$member[no]) Error("수정할 권한이 없습니다");
if ($s_data[ismember]==$member[no]) $name=$member[name];
          else $name=$s_data[name];
  }

  $target="modify_comment_ok.php";

  $memo=stripslashes($s_data[memo]);

  head();

  include $dir."/modify_comment.php";

  foot();

  include "_foot.php";
?>
-------------------------- comment_ok.php를 복사, 수정하여 modify_comment_ok.php 생성 --------------------------
<?

/***************************************************************************
* 공통 파일 include
**************************************************************************/
  include "_head.php";

  if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("정상적으로 글을 수정하여 주시기 바랍니다.");

  if(!$member) $member=member_info();

/***************************************************************************
* 코멘트 수정 진행
**************************************************************************/

// 각종 변수 검사;;
    $memo = str_replace("","",$memo);
    if(isblank($memo)) Error("내용을 입력하셔야 합니다");
    if(!$member[no]) {
      if(isblank($name)) Error("이름을 입력하셔야 합니다");
      if(isblank($password)) Error("비밀번호를 입력하셔야 합니다");
    }

// 필터링;; 관리자가 아닐때;;
    if(!$is_admin&&$setup[use_filter]) {
      $filter=explode(",",$setup[filter]);

      $f_memo=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($memo));
      $f_name=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($name));
      $f_subject=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($subject));
      $f_email=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($email));
      $f_homepage=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($homepage));
      for($i=0;$i<count($filter);$i++)
      if(!isblank($filter[$i])) {
        if(eregi($filter[$i],$f_memo)) Error("<b>$filter[$i]</b> 은(는) 등록하기에 적합한 단어가 아닙니다");
        if(eregi($filter[$i],$f_name)) Error("<b>$filter[$i]</b> 은(는) 등록하기에 적합한 단어가 아닙니다");
      }
    }

// 패스워드를 암호화
    if($password) {
      $temp=mysql_fetch_array(mysql_query("select password('$password')"));
      $password=$temp[0];
    }

// 원본글을 가져옴
    $s_data=mysql_fetch_array(mysql_query("select * from $t_comment"."_$id where no='$c_no'"));

// 회원일때를 확인;;
    if(!$is_admin&&$member[level]>$setup[grant_delete]) {
      if(!$s_data[ismember]) {
        if($s_data[password]!=$password) Error("비밀번호가 올바르지 않습니다");
    }
    else error("사용 권한이 없습니다");

// 관리자이거나 HTML허용레벨이 낮을때 태그의 금지유무를 체크
    if(!$is_admin&&$setup[grant_html]<$member[level]) {
      $memo=del_html($memo);// 내용의 HTML 금지;;
    }

// 회원등록이 되어 있을때 이름등을 가져옴;;
    if($member[no]) {
      if($member[no]!=$s_data[ismember]) $name=$s_data[name];
      else $name=$member[name];
    }

// 각종 변수의 addslashes 시킴
    $name=addslashes(del_html($name));
    $memo=autolink($memo);
    $memo=addslashes($memo);

// 같은 내용이 있는지 검사;;
    if(!$is_admin) {
      $temp=mysql_num_rows(mysql_query("select count(*) from $t_comment"."_$id where memo='$memo' and no='$max_no[0]'"));
      if($temp>0) Error("같은 내용의 글은 등록할수가 없습니다");
    }

// 해당글이 있는 지를 검사
    $check = mysql_num_rows(mysql_query("select count(*) from $t_comment"."_$id where no = '$c_no'", $connect));
    if(!$check) Error("원본 글이 존재하지 않습니다.");

// 코멘트 수정
    mysql_query("update $t_comment"."_$id set name='$name',memo='$memo',ismember='$s_data[ismember]',ip='$REMOTE_ADDR',reg_date='$s_data[reg_date]' where no='$c_no'") or error(mysql_error());

    @mysql_close($connect);

// 페이지 이동
    if($setup[use_alllist]) movepage("zboard.php?id=$id&page=$page&page_num=$page_num&select_arrange=$select_arrange&desc=$des&sn=$sn&ss=$ss&sc=$sc&keyword=$keyword&no=$no");
    else movepage("view.php?id=$id&page=$page&page_num=$page_num&select_arrange=$select_arrange&desc=$des&sn=$sn&ss=$ss&sc=$sc&keyword=$keyword&no=$no");
?>
-------------------- view_write_comment.php 를 복사. 수정하여 modify_comment.php 생성 (nzeo_ver4 기준) --------------------
<table border=0 cellspacing=1 cellpadding=1 class=line1 width=<?=$width?>>
<tr>
  <td bgcolor=white>
    <table border=0 cellspacing=1 cellpadding=8 width=100% height=120 bgcolor=white>
    <script>
      function check_comment_submit(obj) {
        if(obj.memo.value.length<10) {
          alert("코멘트는 10자 이상 적어주세요");
          obj.memo.focus();
          return false;
        }
        return true;
      }
    </script>
    <form method=post name=write action=<?=$target?> onsubmit="return check_comment_submit(this)"><input type=hidden name=page value=<?=$page?>><input type=hidden name=id value=<?=$id?>><input type=hidden name=no value=<?=$no?>><input type=hidden name=c_no value=<?=$c_no?>><input type=hidden name=select_arrange value=<?=$select_arrange?>><input type=hidden name=desc value=<?=$desc?>><input type=hidden name=page_num value=<?=$page_num?>><input type=hidden name=keyword value="<?=$keyword?>"><input type=hidden name=category value="<?=$category?>"><input type=hidden name=sn value="<?=$sn?>"><input type=hidden name=ss value="<?=$ss?>"><input type=hidden name=sc value="<?=$sc?>"><input type=hidden name=mode value="<?=$mode?>">
    <col width=95 align=right style=padding-right:10px></col><col width=></col><col width=95 align=right style=padding-right:10px></col><col width=></col>
    <?if(!$member[no]){?>
    <tr>
      <td class=list0><font class=list_eng><b>이름</b></td>
      <td class=list1><font class=list_han><?=$c_name?></font></td>
      <?=$hide_c_password_start?>
      <td class=list0><font class=list_eng><b>암호</b></td>
      <td class=list1><input type=password name=password <?=size(8)?> maxlength=20 class=input></td>
      <?=$hide_c_password_end?>
    </tr>
    <?}?>
    <tr>
      <td class=list0 onclick="document.write.memo.rows=document.write.memo.rows+4" style=cursor:hand><font class=list_eng><b>짧은글</b><br>▼</td>
      <td class=list1 colspan=4>
        <table border=0 cellspacing=2 cellpadding=0 width=100% height=100%>
        <col width=""></col><col width=100></col>
        <tr>
          <td width=100% colspan=2><textarea name=memo cols=20 rows=8 class=textarea style=width:100%><?=$memo?></textarea></td>
          <td width=100 colspan=2><input type=submit rows=5 class=submit value='  글쓰기  ' accesskey="s" style=height:100%></td>
        </tr>
        </table>
      </td>
    </tr>
    </form>
    </table>
  </td>
</tr>
</table>
------------------------------------------------
끝 ~_~
제목 글쓴이 날짜
[제로카운터 수정하기#4-초보용] 인트로에서 카운트 체크하고 메인에서 카운트 보여주기 [3] 김태훈 2003.01.22
NZEO 쪽지 수신 허용/거부 따라하기 ~(=ㅁ=)~ [12] teslaMINT 2003.01.28
제로보드 코멘트 수정 기능 구현!! [13] teslaMINT 2003.01.28
lotto 번호 추출기 [7] 갑빠™ 2003.01.29
^.^ 그림을 DB에 집어넣어 버리기.. [13] 아이쿠 2003.01.30
PHP,자바스크립트 활용하기 #1 -무단링크라는 것은... [21] ☆좀비파우더™ 2003.01.30
야구 자료실 만들기 1 [8] file 한꼬마 2003.01.30
야구 자료실 2 (목록 만들기) 한꼬마 2003.02.02
제로보드식 에러페이지 만들기 [2] .zeve 2003.02.04
자신의 디비내용을 출력해주는 소스 [출처: phpschool.com] [5] 석이™ 2003.02.05
V3 neo+ 항상 최신버전으로 자동링크시키기 [7] 김현석 2003.02.08
제로보드 스킨들이 어느 게시판에 쓰이는지 알아보는 소스 [12] teslaMINT 2003.02.11
[초간단] 헤더로 asx 파일 음악 주소를 숨겨봐요. [9] 모라미 2003.02.14
DB를 이용한 현재접속자 수 구하기 [6] 김현석 2003.02.14
PHP,자바스크립트 제 3탄! 아래에 헤더로 asx감추기를 이용한 PHP무비 플레이어! file ☆좀비파우더™ 2003.02.16
유용한 함수 몇가지...;;;; [7] Yuki-H. 2003.02.19
계정이 php를 지원하는지아닌지 잘 모를때... [16] 격투왕맹호 2003.02.19
NZEO 이메일 인증 따라하기 [또 수정 --;] [44] file teslaMINT 2003.02.22
여러분이 원하시던 로또복권 소스공개~ [12] Dopesoul 2003.02.22
게시판 통체 인클루드 하기 [12] 깜보 2003.03.02