웹마스터 팁

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

우선 스킨에서, 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>
------------------------------------------------
끝 ~_~
제목 글쓴이 날짜
홈페이지에 실시간뉴스 보여주기 [19] looster 2001.06.05
자기 홈 또는 서버 연지 며칠이 지났는지 알 수 있는 php 소스 [15] 고종길 2001.06.03
대화방을 만들어보쟈~ [20] 해그리드짱!!! 2001.06.03
쿠키 설정하고 불러올때 주의할점;; [윈도우 멀티부팅 사용하시는 초보분만] [9] daftya 2001.05.29
GD를 이용해본 영어 발음기호 image출력 [3] 앤디(andy) 2001.05.24
[APM] 한글, gif, jpeg, png 다되는 GD 설치 [4] 앤디(andy) 2001.05.22
최근게시물 - 첫글은 내용까지, 다음글부터 목록만... [15] СreдturЭ 2001.04.16
공부용 방명록이에욥^^. 주석왕창(페이지분할등.기능있어욥~) [2] 프리^^ 2001.04.16
[추천 팁] phpmyadmin 으로 복구 할때. 후니 2001.02.28
주소에서 음악 파일만 빼와 윈앰프로 실행하기 [1] file 오기 2001.12.04
배경 음악을 한번만 실행 시키기 - 쿠키이용 [4] 오기 2001.12.02
M3U생성 프로그램을 통한 MP3실시간 듣기.. [11] ▒1q▒ 2001.09.13
PHP 인증 페이지를 만들자! - Lesson 3 수정본 #1 [3] ☺[폐]허접-_- 2002.01.24
회원관리 프로그램을 구현하고 싶은신 분들께.. [7] [폐]허접-_- 2002.03.18
PHP 인증 페이지를 만들자! - Lesson 2 수정본 #1 [5] ☺[폐]허접-_- 2002.01.24
PHP 인증 페이지를 만들자! - Lesson 1 수정본 #2 ☺[폐]허접-_- 2002.01.24
노프레임/카운터에 관련된 PHP함수 팁 몇가지 [1] 차카게살자 2001.12.28
MySQL 루트비번 분실시 대처요령 [29] zero 2001.04.18
교육용 방명록 #8 [delete.php3파일에서 넘겨받은 비밀번호를 검사하여 글을 삭제합니다.] [18] zero 2000.07.03
교육용 방명록 #7 [삭제 버튼을 눌렀을 때 비밀번호를 입력받는 부분입니다.] [5] zero 2000.07.03